1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-27 04:44:56 +01:00
parallel/tests/Sync/LockTest.php
2015-09-25 23:41:15 -05:00

33 lines
773 B
PHP

<?php
namespace Icicle\Tests\Concurrent\Sync;
use Icicle\Concurrent\Sync\Lock;
use Icicle\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 \Icicle\Concurrent\Exception\LockAlreadyReleasedError
*/
public function testThrowsOnMultiRelease()
{
$lock = new Lock($this->createCallback(1));
$lock->release();
$lock->release();
}
}