1
0
mirror of https://github.com/danog/file.git synced 2024-11-26 11:54:54 +01:00

Add tests

This commit is contained in:
Daniil Gentili 2024-09-02 16:49:48 +02:00
parent 442b3ac893
commit a6185c5c4f
2 changed files with 42 additions and 0 deletions

View 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());
}
}

View 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');
}
}