You've already forked ugly-queue
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d33fd6bcba | |||
| 89cb1ae4b1 |
@@ -355,6 +355,31 @@ HTML;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $groupName
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function queueExists($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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -630,4 +630,44 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
return $uglyQueue;
|
return $uglyQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user