|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
| 4 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
| 5 | + * |
| 6 | + * Licensed under The MIT License |
| 7 | + * For full copyright and license information, please see the LICENSE.txt |
| 8 | + * Redistributions of files must retain the above copyright notice. |
| 9 | + * |
| 10 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
| 11 | + * @link http://cakephp.org CakePHP(tm) Project |
| 12 | + * @since 3.3.12 |
| 13 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
| 14 | + */ |
| 15 | +namespace Cake\Test\TestCase\Database; |
| 16 | + |
| 17 | +use Cake\Database\ValueBinder; |
| 18 | +use Cake\TestSuite\TestCase; |
| 19 | + |
| 20 | +/** |
| 21 | + * Tests ValueBinder class |
| 22 | + */ |
| 23 | +class ValueBinderTest extends TestCase |
| 24 | +{ |
| 25 | + /** |
| 26 | + * test the placeholder method |
| 27 | + */ |
| 28 | + public function testPlaceholder() |
| 29 | + { |
| 30 | + $valueBinder = new ValueBinder(); |
| 31 | + $result = $valueBinder->placeholder('?'); |
| 32 | + $this->assertEquals('?', $result); |
| 33 | + |
| 34 | + $valueBinder = new ValueBinder(); |
| 35 | + $result = $valueBinder->placeholder(':param'); |
| 36 | + $this->assertEquals(':param', $result); |
| 37 | + |
| 38 | + $valueBinder = new ValueBinder(); |
| 39 | + $result = $valueBinder->placeholder('p'); |
| 40 | + $this->assertEquals(':p0', $result); |
| 41 | + $result = $valueBinder->placeholder('p'); |
| 42 | + $this->assertEquals(':p1', $result); |
| 43 | + $result = $valueBinder->placeholder('c'); |
| 44 | + $this->assertEquals(':c2', $result); |
| 45 | + } |
| 46 | +} |
0 commit comments