Skip to content

Commit a019dbb

Browse files
committed
test(MysqlServerTest) update expectations
1 parent df7cb51 commit a019dbb

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

tests/unit/lucatume/WPBrowser/ManagedProcess/MysqlServerTest.php

+23-19
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use PharData;
1919
use PHPUnit\Framework\Assert;
2020
use PHPUnit\Framework\AssertionFailedError;
21-
use ReflectionMethod;
2221

2322
class MysqlServerTest extends Unit
2423
{
@@ -459,11 +458,7 @@ function (string $url, string $file) use ($mysqlServer): void {
459458
return $mockProcessStep === 'started';
460459
},
461460
'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
467462
]
468463
)
469464
);
@@ -914,12 +909,16 @@ public function testStopThrowsIfPidFileCannotBeUnlinked(): void
914909

915910
// Mock the PID file write.
916911
$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+
);
923922

924923
// The PID file exists.
925924
$this->setFunctionReturn('is_file', function (string $file) use (&$pidFileExists, $pidFile): bool {
@@ -938,7 +937,15 @@ public function testStopThrowsIfPidFileCannotBeUnlinked(): void
938937
'exec' => 1
939938
]));
940939

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+
);
942949
$mysqlServer->start();
943950

944951
$this->expectException(RuntimeException::class);
@@ -1036,13 +1043,10 @@ function (string $url, string $file) use ($mysqlServer): void {
10361043
return $mockProcessStep === 'started';
10371044
},
10381045
'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
10441047
]
1045-
));
1048+
)
1049+
);
10461050

10471051
// Mock the PDO connection.
10481052
$queries = [];

0 commit comments

Comments
 (0)