18
18
use PharData ;
19
19
use PHPUnit \Framework \Assert ;
20
20
use PHPUnit \Framework \AssertionFailedError ;
21
- use ReflectionMethod ;
22
21
23
22
class MysqlServerTest extends Unit
24
23
{
@@ -459,11 +458,7 @@ function (string $url, string $file) use ($mysqlServer): void {
459
458
return $ mockProcessStep === 'started ' ;
460
459
},
461
460
'getPid ' => 2389 ,
462
- 'stop ' => function () use (&$ mockProcessStep ): int {
463
- Assert::assertTrue (in_array ($ mockProcessStep , ['started ' , 'stopped ' ], true ));
464
- $ mockProcessStep = 'stopped ' ;
465
- return 0 ;
466
- }
461
+ 'stop ' => 0
467
462
]
468
463
)
469
464
);
@@ -914,12 +909,16 @@ public function testStopThrowsIfPidFileCannotBeUnlinked(): void
914
909
915
910
// Mock the PID file write.
916
911
$ pidFileExists = false ;
917
- $ this ->setFunctionReturn ('file_put_contents ' , function (string $ file , $ pid ) use ($ pidFile ,&$ pidFileExists ): bool {
918
- Assert::assertEquals ($ pidFile , $ file );
919
- Assert::assertEquals (2389 , $ pid );
920
- $ pidFileExists = true ;
921
- return true ;
922
- }, true );
912
+ $ this ->setFunctionReturn (
913
+ 'file_put_contents ' ,
914
+ function (string $ file , $ pid ) use ($ pidFile , &$ pidFileExists ): bool {
915
+ Assert::assertEquals ($ pidFile , $ file );
916
+ Assert::assertEquals (2389 , $ pid );
917
+ $ pidFileExists = true ;
918
+ return true ;
919
+ },
920
+ true
921
+ );
923
922
924
923
// The PID file exists.
925
924
$ this ->setFunctionReturn ('is_file ' , function (string $ file ) use (&$ pidFileExists , $ pidFile ): bool {
@@ -938,7 +937,15 @@ public function testStopThrowsIfPidFileCannotBeUnlinked(): void
938
937
'exec ' => 1
939
938
]));
940
939
941
- $ mysqlServer = new MysqlServer ($ dir , 12345 , 'someDatabase ' , 'root ' , 'secret ' ,'/usr/bin/mysqld ' , '/some/share/dir ' );
940
+ $ mysqlServer = new MysqlServer (
941
+ $ dir ,
942
+ 12345 ,
943
+ 'someDatabase ' ,
944
+ 'root ' ,
945
+ 'secret ' ,
946
+ '/usr/bin/mysqld ' ,
947
+ '/some/share/dir '
948
+ );
942
949
$ mysqlServer ->start ();
943
950
944
951
$ this ->expectException (RuntimeException::class);
@@ -1036,13 +1043,10 @@ function (string $url, string $file) use ($mysqlServer): void {
1036
1043
return $ mockProcessStep === 'started ' ;
1037
1044
},
1038
1045
'getPid ' => 2389 ,
1039
- 'stop ' => function () use (&$ mockProcessStep ): int {
1040
- Assert::assertTrue (in_array ($ mockProcessStep , ['started ' , 'stopped ' ], true ));
1041
- $ mockProcessStep = 'stopped ' ;
1042
- return 0 ;
1043
- }
1046
+ 'stop ' => 0
1044
1047
]
1045
- ));
1048
+ )
1049
+ );
1046
1050
1047
1051
// Mock the PDO connection.
1048
1052
$ queries = [];
0 commit comments