Adding ability to check for queue group existence

This commit is contained in:
2014-08-11 12:24:05 -05:00
parent 12f6edf269
commit 89cb1ae4b1
2 changed files with 35 additions and 0 deletions

View File

@@ -355,6 +355,15 @@ HTML;
return false;
}
/**
* @param string $groupName
* @return bool
*/
public function queueExists($groupName)
{
return (bool)is_dir($this->getQueueBaseDir().$groupName);
}
/**
* @return boolean
*/

View File

@@ -630,4 +630,30 @@ class UglyQueueTest extends PHPUnit_Framework_TestCase
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);
}
}