1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-04 18:47:50 +01:00
parallel/test/Sync/LockTest.php
Aaron Piotrowski da84a772cf Port to Amp
2016-08-18 11:04:48 -05:00

34 lines
762 B
PHP

<?php
namespace Amp\Tests\Concurrent\Sync;
use Amp\Concurrent\Sync\Lock;
use Amp\Tests\Concurrent\TestCase;
class LockTest extends TestCase
{
public function testIsReleased()
{
$lock = new Lock($this->createCallback(1));
$this->assertFalse($lock->isReleased());
$lock->release();
$this->assertTrue($lock->isReleased());
}
public function testIsReleasedOnDestruct()
{
$lock = new Lock($this->createCallback(1));
unset($lock);
}
/**
* @expectedException \Amp\Concurrent\Exception\LockAlreadyReleasedError
*/
public function testThrowsOnMultiRelease()
{
$lock = new Lock($this->createCallback(1));
$lock->release();
$lock->release();
}
}