44
55use Teto \SQL \Query ;
66use Teto \SQL \DummyPDO ;
7+ use Yoast \PHPUnitPolyfills \Polyfills \ExpectException ;
8+ use Yoast \PHPUnitPolyfills \Polyfills \ExpectPHPException ;
79
810/**
911 * @author USAMI Kenta <[email protected] > 1214 */
1315final class ReplaceHolderTest extends \PHPUnit \Framework \TestCase
1416{
17+ use ExpectException;
18+ use ExpectPHPException;
19+
1520 /**
1621 * @dataProvider acceptDataProvider
1722 */
@@ -21,7 +26,7 @@ public function test_accept($type, $input, $expected)
2126
2227 $ actual = call_user_func (\Closure::bind (function () use ($ pdo , $ type , $ input ) {
2328 return Query::replaceHolder ($ pdo , ':key ' , "@ {$ type }" , $ input , $ bind_values );
24- }, null , Query::class ));
29+ }, null , ' Teto\SQL\ Query' ));
2530
2631 $ this ->assertSame ($ expected , $ actual );
2732 }
@@ -59,12 +64,12 @@ public function test_raise_exception($type, $input, $expected_message)
5964 {
6065 $ pdo = new DummyPDO ();
6166
62- $ this ->expectException (\ DomainException::class );
67+ $ this ->expectException (' DomainException ' );
6368 $ this ->expectExceptionMessage ($ expected_message );
6469
6570 call_user_func (\Closure::bind (function () use ($ pdo , $ type , $ input ) {
6671 return Query::replaceHolder ($ pdo , ':key ' , $ type , $ input , $ bind_values );
67- }, null , Query::class ));
72+ }, null , ' Teto\SQL\ Query' ));
6873 }
6974
7075 public function rejeceptDataProvider ()
@@ -79,7 +84,7 @@ public function rejeceptDataProvider()
7984 ['@int ' , '-9223372036854775809 ' , 'param ":key" is integer out of range. ' ],
8085 ['@int[] ' , 0 , 'param ":key" must be int array ' ],
8186 ['@int[] ' , [], 'param ":key" must be not empty int array ' ],
82- ['@int[] ' , ['1 ' , 'a ' , '3 ' ], 'param ":key[]" is integer out of range. ' ],
87+ ['@int[] ' , ['1 ' , 'a ' , '3 ' ], 'param ":key[1 ]" is integer out of range. ' ],
8388 ['@string ' , [], 'param ":key" must be string or numeric ' ],
8489 ['@string[] ' , '' , 'param ":key" must be string array ' ],
8590 ['@string[] ' , [], 'param ":key" must be not empty string array ' ],
0 commit comments