mirror of
https://github.com/danog/file.git
synced 2024-11-26 11:54:54 +01:00
Add tests
This commit is contained in:
parent
442b3ac893
commit
a6185c5c4f
27
test/KeyedLockingFileMutexTest.php
Normal file
27
test/KeyedLockingFileMutexTest.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Amp\File\Test;
|
||||||
|
|
||||||
|
use Amp\File\KeyedLockingFileMutex;
|
||||||
|
use Amp\Sync\AbstractKeyedMutexTest;
|
||||||
|
use Amp\Sync\KeyedMutex;
|
||||||
|
|
||||||
|
final class KeyedLockingFileMutexTest extends AbstractKeyedMutexTest
|
||||||
|
{
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
Fixture::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
Fixture::clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createMutex(): KeyedMutex
|
||||||
|
{
|
||||||
|
return new KeyedLockingFileMutex(Fixture::path());
|
||||||
|
}
|
||||||
|
}
|
15
test/LockingFileMutexTest.php
Normal file
15
test/LockingFileMutexTest.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Amp\File\Test;
|
||||||
|
|
||||||
|
use Amp\File\LockingFileMutex;
|
||||||
|
use Amp\Sync\AbstractMutexTest;
|
||||||
|
use Amp\Sync\Mutex;
|
||||||
|
|
||||||
|
final class LockingFileMutexTest extends AbstractMutexTest
|
||||||
|
{
|
||||||
|
public function createMutex(): Mutex
|
||||||
|
{
|
||||||
|
return new LockingFileMutex(\tempnam(\sys_get_temp_dir(), 'mutex-') . '.lock');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user