1<?php 2 3/** 4 * This file is part of the Phalcon Framework. 5 * 6 * For the full copyright and license information, please view the LICENSE.md 7 * file that was distributed with this source code. 8 */ 9 10declare(strict_types=1); 11 12namespace Phalcon\Test\Database\DataMapper\Pdo\Connection; 13 14use DatabaseTester; 15use Phalcon\DataMapper\Pdo\Connection; 16use Phalcon\Test\Fixtures\Migrations\InvoicesMigration; 17 18class FetchValueCest 19{ 20 /** 21 * Database Tests Phalcon\DataMapper\Pdo\Connection :: fetchValue() 22 * 23 * @since 2020-01-25 24 */ 25 public function dMPdoConnectionFetchValue(DatabaseTester $I) 26 { 27 $I->wantToTest('DataMapper\Pdo\Connection - fetchValue()'); 28 29 /** @var Connection $connection */ 30 $connection = $I->getDataMapperConnection(); 31 $migration = new InvoicesMigration($connection); 32 $migration->clear(); 33 34 $result = $migration->insert(1, 1, 1, null, 101); 35 $I->assertEquals(1, $result); 36 37 $all = $connection->fetchValue( 38 'select inv_total from co_invoices WHERE inv_cst_id = ?', 39 [ 40 0 => 1, 41 ] 42 ); 43 $I->assertEquals(101, $all); 44 } 45} 46