You've already forked ugly-queue
Adding ability to get list of initialized queues.
This commit is contained in:
@@ -361,7 +361,23 @@ HTML;
|
||||
*/
|
||||
public function queueExists($groupName)
|
||||
{
|
||||
return (bool)is_dir($this->getQueueBaseDir().$groupName);
|
||||
return (bool)is_dir($this->queueBaseDir.$groupName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getInitializedQueueList()
|
||||
{
|
||||
$queueList = array();
|
||||
foreach(glob(realpath($this->queueBaseDir).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR) as $queueDir)
|
||||
{
|
||||
$exp = explode(DIRECTORY_SEPARATOR, $queueDir);
|
||||
$dir = end($exp);
|
||||
if (strpos($dir, '.') !== 0)
|
||||
$queueList[] = $dir;
|
||||
}
|
||||
return $queueList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -656,4 +656,18 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user