라이브러리 업데이트 catfan/medoo 추가

This commit is contained in:
2018-07-23 21:27:26 +09:00
parent 3e81a4e3fe
commit 7b0cffcf30
15 changed files with 2180 additions and 42 deletions
+28
View File
@@ -11,6 +11,7 @@
namespace Symfony\Component\Lock\Tests\Store;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\Store\SemaphoreStore;
/**
@@ -29,4 +30,31 @@ class SemaphoreStoreTest extends AbstractStoreTest
{
return new SemaphoreStore();
}
public function testResourceRemoval()
{
$initialCount = $this->getOpenedSemaphores();
$store = new SemaphoreStore();
$key = new Key(uniqid(__METHOD__, true));
$store->waitAndSave($key);
$this->assertGreaterThan($initialCount, $this->getOpenedSemaphores(), 'Semaphores should have been created');
$store->delete($key);
$this->assertEquals($initialCount, $this->getOpenedSemaphores(), 'All semaphores should be removed');
}
private function getOpenedSemaphores()
{
$lines = explode(PHP_EOL, trim(`ipcs -su`));
if ('------ Semaphore Status --------' !== $lines[0]) {
throw new \Exception('Failed to extract list of opend semaphores. Expect a Semaphore status, got '.implode(PHP_EOL, $lines));
}
list($key, $value) = explode(' = ', $lines[1]);
if ('used arrays' !== $key) {
throw new \Exception('Failed to extract list of opend semaphores. Expect a used arrays key, got '.implode(PHP_EOL, $lines));
}
return (int) $value;
}
}