public function Redis_Tests_Queue_AbstractQueueUnitTestCase::testOrder in Redis 7.2
File
- lib/
Redis/ Tests/ Queue/ AbstractQueueUnitTestCase.php, line 79
Class
- Redis_Tests_Queue_AbstractQueueUnitTestCase
- Some tests in there credits goes to the redis_queue module. Thanks to their author.
Code
public function testOrder() {
$keys = array(
'test1',
'test2',
'test3',
);
foreach ($keys as $k) {
$this->queue
->createItem($k);
}
$first = $this->queue
->claimItem();
$this
->assertEqual($first->data, $keys[0]);
$second = $this->queue
->claimItem();
$this
->assertEqual($second->data, $keys[1]);
$this->queue
->releaseItem($first);
$third = $this->queue
->claimItem();
$this
->assertEqual($third->data, $keys[2]);
$first_again = $this->queue
->claimItem();
$this
->assertEqual($first_again->data, $keys[0]);
$num = $this->queue
->numberOfItems();
$this
->assertEqual(0, $num);
}