Skip to content

Commit 5a3eb5c

Browse files
Merge branch '4.0' into 4.1
* 4.0: [Form] Fix fixtures for forward compat [Lock] Fix SemaphoreStoreTest on OS X
2 parents 28ef128 + ea1716b commit 5a3eb5c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Tests/Store/SemaphoreStoreTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,22 @@ public function testResourceRemoval()
4646

4747
private function getOpenedSemaphores()
4848
{
49+
if ('Darwin' === PHP_OS) {
50+
$lines = explode(PHP_EOL, trim(`ipcs -s`));
51+
if (-1 === $start = array_search('Semaphores:', $lines)) {
52+
throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore list, got '.implode(PHP_EOL, $lines));
53+
}
54+
55+
return \count(\array_slice($lines, ++$start));
56+
}
57+
4958
$lines = explode(PHP_EOL, trim(`LC_ALL=C ipcs -su`));
5059
if ('------ Semaphore Status --------' !== $lines[0]) {
51-
throw new \Exception('Failed to extract list of opend semaphores. Expect a Semaphore status, got '.implode(PHP_EOL, $lines));
60+
throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore status, got '.implode(PHP_EOL, $lines));
5261
}
5362
list($key, $value) = explode(' = ', $lines[1]);
5463
if ('used arrays' !== $key) {
55-
throw new \Exception('Failed to extract list of opend semaphores. Expect a used arrays key, got '.implode(PHP_EOL, $lines));
64+
throw new \Exception('Failed to extract list of opened semaphores. Expected a "used arrays" key, got '.implode(PHP_EOL, $lines));
5665
}
5766

5867
return (int) $value;

0 commit comments

Comments
 (0)