2014-09-29 17:02:28 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class UglyQueueManagerTest
|
|
|
|
|
*/
|
|
|
|
|
class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
2014-09-29 17:18:14 -05:00
|
|
|
/**
|
|
|
|
|
* @covers \DCarbone\UglyQueueManager::__construct
|
|
|
|
|
* @covers \DCarbone\UglyQueueManager::init
|
|
|
|
|
* @covers \DCarbone\UglyQueue::unserialize
|
|
|
|
|
* @covers \DCarbone\UglyQueueManager::addQueue
|
|
|
|
|
* @covers \DCarbone\UglyQueueManager::containsQueueWithName
|
|
|
|
|
* @uses \DCarbone\UglyQueueManager
|
|
|
|
|
* @uses \DCarbone\UglyQueue
|
|
|
|
|
* @return \DCarbone\UglyQueueManager
|
|
|
|
|
*/
|
|
|
|
|
public function testCanInitializeManagerWithConfigAndNoObservers()
|
|
|
|
|
{
|
|
|
|
|
$config = array(
|
|
|
|
|
'queue-base-dir' => __DIR__.'/../misc/'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$manager = \DCarbone\UglyQueueManager::init($config);
|
|
|
|
|
|
|
|
|
|
$this->assertInstanceOf('\\DCarbone\\UglyQueueManager', $manager);
|
|
|
|
|
|
|
|
|
|
return $manager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers \DCarbone\UglyQueueManager::init
|
|
|
|
|
* @covers \DCarbone\UglyQueueManager::__construct
|
|
|
|
|
* @uses \DCarbone\UglyQueueManager
|
|
|
|
|
* @expectedException \RuntimeException
|
|
|
|
|
*/
|
|
|
|
|
public function testExceptionThrownDuringConstructionWithInvalidBasePathValue()
|
|
|
|
|
{
|
|
|
|
|
$config = array(
|
|
|
|
|
'queue-base-dir' => 'i do not exist!'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$manager = \DCarbone\UglyQueueManager::init($config);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers \DCarbone\UglyQueueManager::init
|
|
|
|
|
* @covers \DCarbone\UglyQueueManager::__construct
|
|
|
|
|
* @uses \DCarbone\UglyQueueManager
|
|
|
|
|
* @expectedException \InvalidArgumentException
|
|
|
|
|
*/
|
|
|
|
|
public function testExceptionThrownDuringConstructionWithInvalidConfArray()
|
|
|
|
|
{
|
|
|
|
|
$config = array(
|
|
|
|
|
'wrong-key' => 'wrong value'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$manager = \DCarbone\UglyQueueManager::init($config);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-29 17:02:28 -05:00
|
|
|
// /**
|
|
|
|
|
// * @covers \DCarbone\UglyQueue::queueExists
|
|
|
|
|
// * @uses \DCarbone\UglyQueue
|
|
|
|
|
// * @depends testCanInitializeNewUglyQueue
|
|
|
|
|
// * @param \DCarbone\UglyQueue $uglyQueue
|
|
|
|
|
// */
|
|
|
|
|
// public function testCanDetermineExistenceOfExistingQueue(\DCarbone\UglyQueue $uglyQueue)
|
|
|
|
|
// {
|
|
|
|
|
// $exists = $uglyQueue->queueExists('tasty-sandwich');
|
|
|
|
|
//
|
|
|
|
|
// $this->assertTrue($exists);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * @covers \DCarbone\UglyQueue::queueExists
|
|
|
|
|
// * @uses \DCarbone\UglyQueue
|
|
|
|
|
// * @depends testCanInitializeNewUglyQueue
|
|
|
|
|
// * @param \DCarbone\UglyQueue $uglyQueue
|
|
|
|
|
// */
|
|
|
|
|
// public function testCanDetermineExistenceOfNonExistingQueue(\DCarbone\UglyQueue $uglyQueue)
|
|
|
|
|
// {
|
|
|
|
|
// $exists = $uglyQueue->queueExists('nasty-sandwich');
|
|
|
|
|
//
|
|
|
|
|
// $this->assertFalse($exists);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * @covers \DCarbone\UglyQueue::getInitializedQueueList
|
|
|
|
|
// * @uses \DCarbone\UglyQueue
|
|
|
|
|
// * @depends testCanInitializeNewUglyQueue
|
|
|
|
|
// * @param \DCarbone\UglyQueue $uglyQueue
|
|
|
|
|
// */
|
|
|
|
|
// public function testCanGetListOfInitializedQueues(\DCarbone\UglyQueue $uglyQueue)
|
|
|
|
|
// {
|
|
|
|
|
// $queueList = $uglyQueue->getInitializedQueueList();
|
|
|
|
|
//
|
|
|
|
|
// $this->assertEquals(1, count($queueList));
|
|
|
|
|
// $this->assertContains('tasty-sandwich', $queueList);
|
|
|
|
|
// }
|
|
|
|
|
}
|