@@ -17,8 +17,6 @@ public function testSelectStaticText()
1717 $ this ->assertCount (1 , $ command ->resultRows );
1818 $ this ->assertCount (1 , $ command ->resultRows [0 ]);
1919 $ this ->assertSame ('foo ' , reset ($ command ->resultRows [0 ]));
20-
21- $ this ->assertInstanceOf ('React\MySQL\Connection ' , $ conn );
2220 });
2321
2422 $ connection ->quit ();
@@ -57,7 +55,7 @@ public function testSelectStaticValueWillBeReturnedAsIs($value)
5755 $ this ->assertCount (1 , $ command ->resultRows );
5856 $ this ->assertCount (1 , $ command ->resultRows [0 ]);
5957 $ this ->assertSame ($ expected , reset ($ command ->resultRows [0 ]));
60- })-> then ( null , ' printf ' ) ;
58+ });
6159
6260 $ connection ->quit ();
6361 Loop::run ();
@@ -82,7 +80,7 @@ public function testSelectStaticValueWillBeReturnedAsIsWithNoBackslashEscapesSql
8280 $ this ->assertCount (1 , $ command ->resultRows );
8381 $ this ->assertCount (1 , $ command ->resultRows [0 ]);
8482 $ this ->assertSame ($ expected , reset ($ command ->resultRows [0 ]));
85- })-> then ( null , ' printf ' ) ;
83+ });
8684
8785 $ connection ->quit ();
8886 Loop::run ();
@@ -138,7 +136,7 @@ public function testSelectLongStaticTextHasTypeStringWithValidLength()
138136
139137 $ connection ->query ('SELECT ? ' , [$ value ])->then (function (QueryResult $ command ) use ($ length ) {
140138 $ this ->assertCount (1 , $ command ->resultFields );
141- $ this ->assertEquals ($ length * 3 , $ command ->resultFields [0 ]['length ' ]);
139+ $ this ->assertEquals ($ length * 4 , $ command ->resultFields [0 ]['length ' ]);
142140 $ this ->assertSame (Constants::FIELD_TYPE_VAR_STRING , $ command ->resultFields [0 ]['type ' ]);
143141 });
144142
@@ -430,7 +428,7 @@ public function testInvalidSelectShouldFail()
430428
431429 $ connection ->query ('select * from invalid_table ' )->then (
432430 $ this ->expectCallableNever (),
433- function (\Exception $ error ) {
431+ function (\Exception $ error ) use ( $ db ) {
434432 $ this ->assertEquals ("Table ' $ db.invalid_table' doesn't exist " , $ error ->getMessage ());
435433 }
436434 );
@@ -446,7 +444,13 @@ public function testInvalidMultiStatementsShouldFailToPreventSqlInjections()
446444 $ connection ->query ('select 1;select 2; ' )->then (
447445 $ this ->expectCallableNever (),
448446 function (\Exception $ error ) {
449- $ this ->assertContains ("You have an error in your SQL syntax " , $ error ->getMessage ());
447+ if (method_exists ($ this , 'assertStringContainsString ' )) {
448+ // PHPUnit 9+
449+ $ this ->assertStringContainsString ("You have an error in your SQL syntax " , $ error ->getMessage ());
450+ } else {
451+ // legacy PHPUnit < 9
452+ $ this ->assertContains ("You have an error in your SQL syntax " , $ error ->getMessage ());
453+ }
450454 }
451455 );
452456
0 commit comments