1<?php 2 3/** 4 * This file is part of the Phalcon Framework. 5 * 6 * (c) Phalcon Team <team@phalcon.io> 7 * 8 * For the full copyright and license information, please view the LICENSE.txt 9 * file that was distributed with this source code. 10 */ 11 12declare(strict_types=1); 13 14namespace Phalcon\Test\Database\DataMapper\Query\Bind; 15 16use DatabaseTester; 17use Phalcon\DataMapper\Query\Bind; 18 19class SetValuesCest 20{ 21 /** 22 * Database Tests Phalcon\DataMapper\Query\Bind :: setValues() 23 * 24 * @since 2020-01-20 25 */ 26 public function dMQueryBindSetValues(DatabaseTester $I) 27 { 28 $I->wantToTest('DataMapper\Query\Bind - setValues()'); 29 30 $bind = new Bind(); 31 32 $expected = []; 33 $actual = $bind->toArray(); 34 $I->assertEquals($expected, $actual); 35 36 $bind->setValues( 37 [ 38 "one" => "two", 39 "three" => "four", 40 "five" => ["six", "seven", 8, 9], 41 ] 42 ); 43 44 $bind->setValue("nine", null); 45 $bind->setValue("ten", false); 46 $bind->setValue("eleven", 11); 47 48 $expected = [ 49 "one" => ["two", 2], 50 "three" => ["four", 2], 51 "five" => [['six', 'seven', 8, 9], 2], 52 "nine" => [null, 0], 53 "ten" => [false, 5], 54 "eleven" => [11, 1], 55 ]; 56 $actual = $bind->toArray(); 57 $I->assertEquals($expected, $actual); 58 } 59} 60