@@ -20,10 +20,8 @@ public function testLockWithValidAccount(): void
2020 $ dbi = $ this ->createMock (DatabaseInterface::class);
2121 $ dbi ->expects ($ this ->once ())->method ('isMariaDB ' )->willReturn (true );
2222 $ dbi ->expects ($ this ->once ())->method ('getVersion ' )->willReturn (100402 );
23- $ dbi ->expects ($ this ->exactly (2 ))
24- ->method ('escapeString ' )
25- ->withConsecutive ([$ this ->equalTo ('test.user ' )], [$ this ->equalTo ('test.host ' )])
26- ->willReturnOnConsecutiveCalls ('test.user ' , 'test.host ' );
23+ $ dbi ->expects ($ this ->exactly (2 ))->method ('quoteString ' )
24+ ->will ($ this ->returnCallback (static fn (string $ string ) => "' " . $ string . "' " ));
2725 $ dbi ->expects ($ this ->once ())
2826 ->method ('tryQuery ' )
2927 ->with ($ this ->equalTo ('ALTER USER \'test.user \'@ \'test.host \' ACCOUNT LOCK; ' ))
@@ -39,10 +37,8 @@ public function testLockWithInvalidAccount(): void
3937 $ dbi = $ this ->createMock (DatabaseInterface::class);
4038 $ dbi ->expects ($ this ->once ())->method ('isMariaDB ' )->willReturn (true );
4139 $ dbi ->expects ($ this ->once ())->method ('getVersion ' )->willReturn (100402 );
42- $ dbi ->expects ($ this ->exactly (2 ))
43- ->method ('escapeString ' )
44- ->withConsecutive ([$ this ->equalTo ('test.user ' )], [$ this ->equalTo ('test.host ' )])
45- ->willReturnOnConsecutiveCalls ('test.user ' , 'test.host ' );
40+ $ dbi ->expects ($ this ->exactly (2 ))->method ('quoteString ' )
41+ ->will ($ this ->returnCallback (static fn (string $ string ) => "' " . $ string . "' " ));
4642 $ dbi ->expects ($ this ->once ())
4743 ->method ('tryQuery ' )
4844 ->with ($ this ->equalTo ('ALTER USER \'test.user \'@ \'test.host \' ACCOUNT LOCK; ' ))
@@ -62,7 +58,7 @@ public function testLockWithUnsupportedServer(): void
6258 $ dbi = $ this ->createMock (DatabaseInterface::class);
6359 $ dbi ->expects ($ this ->once ())->method ('isMariaDB ' )->willReturn (true );
6460 $ dbi ->expects ($ this ->once ())->method ('getVersion ' )->willReturn (100401 );
65- $ dbi ->expects ($ this ->never ())->method ('escapeString ' );
61+ $ dbi ->expects ($ this ->never ())->method ('quoteString ' );
6662 $ dbi ->expects ($ this ->never ())->method ('tryQuery ' );
6763 $ dbi ->expects ($ this ->never ())->method ('getError ' );
6864
@@ -79,10 +75,8 @@ public function testUnlockWithValidAccount(): void
7975 $ dbi = $ this ->createMock (DatabaseInterface::class);
8076 $ dbi ->expects ($ this ->once ())->method ('isMariaDB ' )->willReturn (true );
8177 $ dbi ->expects ($ this ->once ())->method ('getVersion ' )->willReturn (100402 );
82- $ dbi ->expects ($ this ->exactly (2 ))
83- ->method ('escapeString ' )
84- ->withConsecutive ([$ this ->equalTo ('test.user ' )], [$ this ->equalTo ('test.host ' )])
85- ->willReturnOnConsecutiveCalls ('test.user ' , 'test.host ' );
78+ $ dbi ->expects ($ this ->exactly (2 ))->method ('quoteString ' )
79+ ->will ($ this ->returnCallback (static fn (string $ string ) => "' " . $ string . "' " ));
8680 $ dbi ->expects ($ this ->once ())
8781 ->method ('tryQuery ' )
8882 ->with ($ this ->equalTo ('ALTER USER \'test.user \'@ \'test.host \' ACCOUNT UNLOCK; ' ))
@@ -98,10 +92,8 @@ public function testUnlockWithInvalidAccount(): void
9892 $ dbi = $ this ->createMock (DatabaseInterface::class);
9993 $ dbi ->expects ($ this ->once ())->method ('isMariaDB ' )->willReturn (true );
10094 $ dbi ->expects ($ this ->once ())->method ('getVersion ' )->willReturn (100402 );
101- $ dbi ->expects ($ this ->exactly (2 ))
102- ->method ('escapeString ' )
103- ->withConsecutive ([$ this ->equalTo ('test.user ' )], [$ this ->equalTo ('test.host ' )])
104- ->willReturnOnConsecutiveCalls ('test.user ' , 'test.host ' );
95+ $ dbi ->expects ($ this ->exactly (2 ))->method ('quoteString ' )
96+ ->will ($ this ->returnCallback (static fn (string $ string ) => "' " . $ string . "' " ));
10597 $ dbi ->expects ($ this ->once ())
10698 ->method ('tryQuery ' )
10799 ->with ($ this ->equalTo ('ALTER USER \'test.user \'@ \'test.host \' ACCOUNT UNLOCK; ' ))
@@ -121,7 +113,7 @@ public function testUnlockWithUnsupportedServer(): void
121113 $ dbi = $ this ->createMock (DatabaseInterface::class);
122114 $ dbi ->expects ($ this ->once ())->method ('isMariaDB ' )->willReturn (false );
123115 $ dbi ->expects ($ this ->once ())->method ('getVersion ' )->willReturn (50705 );
124- $ dbi ->expects ($ this ->never ())->method ('escapeString ' );
116+ $ dbi ->expects ($ this ->never ())->method ('quoteString ' );
125117 $ dbi ->expects ($ this ->never ())->method ('tryQuery ' );
126118 $ dbi ->expects ($ this ->never ())->method ('getError ' );
127119
0 commit comments