public function testFileLockException() { $file = new \Ark4ne\LightQueue\Provider\FileLockable(Config::get('queue.lightqueue.queue_directory') . md5('testFileLockException') . ".queue"); $queue = new FileQueueProvider('testFileLockException'); $file->handle(); $this->assertEquals($queue->getFile()->getPath(), $file->getPath()); $this->assertTrue($file->lock()); $this->assertFalse($queue->push('test')); $this->assertTrue($file->unlock()); $this->assertTrue($queue->push('test')); $this->assertTrue($file->lock()); $this->assertNull($queue->next()); $this->assertTrue($file->unlock()); $this->assertNotNull($queue->next()); }
public function testLocker() { $file = new \Ark4ne\LightQueue\Provider\FileLockable('test_file.tester'); $file2 = new \Ark4ne\LightQueue\Provider\FileLockable('test_file.tester'); $this->assertNotNull($file->handle()); $this->assertNotNull($file2->handle()); $this->assertTrue($file->lock()); $this->setExpectedException('Ark4ne\\LightQueue\\Exception\\LightQueueException', "FileLockable::_flock: Can't got lock for queue file !"); $this->assertFalse($file2->lock()); $this->assertTrue($file->unlock()); $this->assertTrue($file2->lock()); $this->assertTrue($file2->unlock()); $file->close(); $file2->close(); }