You've already forked ugly-queue
tests: Updated tests for later PHPUnit 🔥
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Class UglyQueueManagerTest
|
||||
*/
|
||||
class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
|
||||
class UglyQueueManagerTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected $baseDir;
|
||||
|
||||
@@ -13,47 +13,47 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
|
||||
'2' => 'boneless pork ribs',
|
||||
);
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->baseDir = realpath(__DIR__.'/../misc/queues');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \DCarbone\UglyQueueManager::__construct
|
||||
* @covers \DCarbone\UglyQueue::unserialize
|
||||
* @covers \DCarbone\UglyQueueManager::addQueue
|
||||
* @covers \DCarbone\UglyQueueManager::containsQueueWithName
|
||||
* @uses \DCarbone\UglyQueueManager
|
||||
* @uses \DCarbone\UglyQueue
|
||||
* @return \DCarbone\UglyQueueManager
|
||||
* @covers \Cybercinch\UglyQueueManager::__construct
|
||||
* @covers \Cybercinch\UglyQueue::unserialize
|
||||
* @covers \Cybercinch\UglyQueueManager::addQueue
|
||||
* @covers \Cybercinch\UglyQueueManager::containsQueueWithName
|
||||
* @uses \Cybercinch\UglyQueueManager
|
||||
* @uses \Cybercinch\UglyQueue
|
||||
* @return \Cybercinch\UglyQueueManager
|
||||
*/
|
||||
public function testCanInitializeObjectWithValidPath()
|
||||
{
|
||||
$manager = new \DCarbone\UglyQueueManager($this->baseDir);
|
||||
$manager = new \Cybercinch\UglyQueueManager($this->baseDir);
|
||||
|
||||
$this->assertInstanceOf('\\DCarbone\\UglyQueueManager', $manager);
|
||||
$this->assertInstanceOf('\\Cybercinch\\UglyQueueManager', $manager);
|
||||
|
||||
return $manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \DCarbone\UglyQueueManager::__construct
|
||||
* @uses \DCarbone\UglyQueueManager
|
||||
* @expectedException \RuntimeException
|
||||
* @covers \Cybercinch\UglyQueueManager::__construct
|
||||
* @uses \Cybercinch\UglyQueueManager
|
||||
*/
|
||||
public function testExceptionThrownDuringConstructionWithInvalidBasePathValue()
|
||||
{
|
||||
new \DCarbone\UglyQueueManager('i do not exist!');
|
||||
$this->expectException(RuntimeException::class);
|
||||
new \Cybercinch\UglyQueueManager('i do not exist!');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers \DCarbone\UglyQueueManager::containsQueueWithName
|
||||
* @uses \DCarbone\UglyQueueManager
|
||||
* @covers \Cybercinch\UglyQueueManager::containsQueueWithName
|
||||
* @uses \Cybercinch\UglyQueueManager
|
||||
* @depends testCanInitializeObjectWithValidPath
|
||||
* @param \DCarbone\UglyQueueManager $manager
|
||||
* @param \Cybercinch\UglyQueueManager $manager
|
||||
*/
|
||||
public function testCanDetermineIfValidQueueExistsInManager(\DCarbone\UglyQueueManager $manager)
|
||||
public function testCanDetermineIfValidQueueExistsInManager(\Cybercinch\UglyQueueManager $manager)
|
||||
{
|
||||
$shouldBeTrue = $manager->containsQueueWithName('tasty-sandwich');
|
||||
|
||||
@@ -61,12 +61,12 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \DCarbone\UglyQueueManager::containsQueueWithName
|
||||
* @uses \DCarbone\UglyQueueManager
|
||||
* @covers \Cybercinch\UglyQueueManager::containsQueueWithName
|
||||
* @uses \Cybercinch\UglyQueueManager
|
||||
* @depends testCanInitializeObjectWithValidPath
|
||||
* @param \DCarbone\UglyQueueManager $manager
|
||||
* @param \Cybercinch\UglyQueueManager $manager
|
||||
*/
|
||||
public function testCanDetermineQueueDoesNotExistInManager(\DCarbone\UglyQueueManager $manager)
|
||||
public function testCanDetermineQueueDoesNotExistInManager(\Cybercinch\UglyQueueManager $manager)
|
||||
{
|
||||
$shouldBeFalse = $manager->containsQueueWithName('i should not exist');
|
||||
|
||||
@@ -74,95 +74,95 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \DCarbone\UglyQueueManager::getQueueWithName
|
||||
* @uses \DCarbone\UglyQueueManager
|
||||
* @uses \DCarbone\UglyQueue
|
||||
* @covers \Cybercinch\UglyQueueManager::getQueueWithName
|
||||
* @uses \Cybercinch\UglyQueueManager
|
||||
* @uses \Cybercinch\UglyQueue
|
||||
* @depends testCanInitializeObjectWithValidPath
|
||||
* @param \DCarbone\UglyQueueManager $manager
|
||||
* @param \Cybercinch\UglyQueueManager $manager
|
||||
*/
|
||||
public function testCanGetUglyQueueObjectFromManager(\DCarbone\UglyQueueManager $manager)
|
||||
public function testCanGetUglyQueueObjectFromManager(\Cybercinch\UglyQueueManager $manager)
|
||||
{
|
||||
$uglyQueue = $manager->getQueueWithName('tasty-sandwich');
|
||||
|
||||
$this->assertInstanceOf('\\DCarbone\\UglyQueue', $uglyQueue);
|
||||
$this->assertInstanceOf('\\Cybercinch\\UglyQueue', $uglyQueue);
|
||||
$this->assertEquals('tasty-sandwich', $uglyQueue->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \DCarbone\UglyQueueManager::getQueueWithName
|
||||
* @uses \DCarbone\UglyQueueManager
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @covers \Cybercinch\UglyQueueManager::getQueueWithName
|
||||
* @uses \Cybercinch\UglyQueueManager
|
||||
* @depends testCanInitializeObjectWithValidPath
|
||||
* @param \DCarbone\UglyQueueManager $manager
|
||||
* @param \Cybercinch\UglyQueueManager $manager
|
||||
*/
|
||||
public function testExceptionThrownWhenTryingToGetNonExistentQueueFromManager(\DCarbone\UglyQueueManager $manager)
|
||||
public function testExceptionThrownWhenTryingToGetNonExistentQueueFromManager(\Cybercinch\UglyQueueManager $manager)
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$manager->getQueueWithName('sandwiches');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \DCarbone\UglyQueueManager::getQueueList
|
||||
* @uses \DCarbone\UglyQueueManager
|
||||
* @covers \Cybercinch\UglyQueueManager::getQueueList
|
||||
* @uses \Cybercinch\UglyQueueManager
|
||||
* @depends testCanInitializeObjectWithValidPath
|
||||
* @param \DCarbone\UglyQueueManager $manager
|
||||
* @param \Cybercinch\UglyQueueManager $manager
|
||||
*/
|
||||
public function testCanGetListOfQueuesInManager(\DCarbone\UglyQueueManager $manager)
|
||||
public function testCanGetListOfQueuesInManager(\Cybercinch\UglyQueueManager $manager)
|
||||
{
|
||||
$queueList = $manager->getQueueList();
|
||||
|
||||
$this->assertInternalType('array', $queueList);
|
||||
$this->assertIsArray($queueList);
|
||||
$this->assertCount(1, $queueList);
|
||||
$this->assertContains('tasty-sandwich', $queueList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \DCarbone\UglyQueueManager::getQueueWithName
|
||||
* @covers \DCarbone\UglyQueueManager::addQueue
|
||||
* @uses \DCarbone\UglyQueueManager
|
||||
* @uses \DCarbone\UglyQueue
|
||||
* @expectedException \RuntimeException
|
||||
* @covers \Cybercinch\UglyQueueManager::getQueueWithName
|
||||
* @covers \Cybercinch\UglyQueueManager::addQueue
|
||||
* @uses \Cybercinch\UglyQueueManager
|
||||
* @uses \Cybercinch\UglyQueue
|
||||
* @depends testCanInitializeObjectWithValidPath
|
||||
* @param \DCarbone\UglyQueueManager $manager
|
||||
* @param \Cybercinch\UglyQueueManager $manager
|
||||
*/
|
||||
public function testExceptionThrownWhenReAddingQueueToManager(\DCarbone\UglyQueueManager $manager)
|
||||
public function testExceptionThrownWhenReAddingQueueToManager(\Cybercinch\UglyQueueManager $manager)
|
||||
{
|
||||
$this->expectException(RuntimeException::class);
|
||||
$uglyQueue = $manager->getQueueWithName('tasty-sandwich');
|
||||
|
||||
$manager->addQueue($uglyQueue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \DCarbone\UglyQueueManager::addQueueAtPath
|
||||
* @covers \DCarbone\UglyQueueManager::addQueue
|
||||
* @covers \DCarbone\UglyQueueManager::getQueueWithName
|
||||
* @uses \DCarbone\UglyQueueManager
|
||||
* @uses \DCarbone\UglyQueue
|
||||
* @covers \Cybercinch\UglyQueueManager::addQueueAtPath
|
||||
* @covers \Cybercinch\UglyQueueManager::addQueue
|
||||
* @covers \Cybercinch\UglyQueueManager::getQueueWithName
|
||||
* @uses \Cybercinch\UglyQueueManager
|
||||
* @uses \Cybercinch\UglyQueue
|
||||
* @depends testCanInitializeObjectWithValidPath
|
||||
* @param \DCarbone\UglyQueueManager $manager
|
||||
* @param \Cybercinch\UglyQueueManager $manager
|
||||
*/
|
||||
public function testCanInitializeNewQueueAndAddToManager(\DCarbone\UglyQueueManager $manager)
|
||||
public function testCanInitializeNewQueueAndAddToManager(\Cybercinch\UglyQueueManager $manager)
|
||||
{
|
||||
$manager->addQueueAtPath($this->baseDir.'/really-tasty-sandwich');
|
||||
|
||||
$uglyQueue = $manager->getQueueWithName('really-tasty-sandwich');
|
||||
|
||||
$this->assertInstanceOf('\\DCarbone\\UglyQueue', $uglyQueue);
|
||||
$this->assertInstanceOf('\\Cybercinch\\UglyQueue', $uglyQueue);
|
||||
$this->assertEquals('really-tasty-sandwich', $uglyQueue->getName());
|
||||
|
||||
$queueList = $manager->getQueueList();
|
||||
|
||||
$this->assertInternalType('array', $queueList);
|
||||
$this->assertIsArray($queueList);
|
||||
$this->assertCount(2, $queueList);
|
||||
$this->assertContains('really-tasty-sandwich', $queueList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \DCarbone\UglyQueueManager::removeQueueByName
|
||||
* @uses \DCarbone\UglyQueueManager
|
||||
* @covers \Cybercinch\UglyQueueManager::removeQueueByName
|
||||
* @uses \Cybercinch\UglyQueueManager
|
||||
* @depends testCanInitializeObjectWithValidPath
|
||||
* @param \DCarbone\UglyQueueManager $manager
|
||||
* @param \Cybercinch\UglyQueueManager $manager
|
||||
*/
|
||||
public function testCanRemoveQueueFromManagerByName(\DCarbone\UglyQueueManager $manager)
|
||||
public function testCanRemoveQueueFromManagerByName(\Cybercinch\UglyQueueManager $manager)
|
||||
{
|
||||
$manager->removeQueueByName('really-tasty-sandwich');
|
||||
|
||||
@@ -173,12 +173,12 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @covers \DCarbone\UglyQueue::queueExists
|
||||
// * @uses \DCarbone\UglyQueue
|
||||
// * @covers \Cybercinch\UglyQueue::queueExists
|
||||
// * @uses \Cybercinch\UglyQueue
|
||||
// * @depends testCanInitializeNewUglyQueue
|
||||
// * @param \DCarbone\UglyQueue $uglyQueue
|
||||
// * @param \Cybercinch\UglyQueue $uglyQueue
|
||||
// */
|
||||
// public function testCanDetermineExistenceOfExistingQueue(\DCarbone\UglyQueue $uglyQueue)
|
||||
// public function testCanDetermineExistenceOfExistingQueue(\Cybercinch\UglyQueue $uglyQueue)
|
||||
// {
|
||||
// $exists = $uglyQueue->queueExists('tasty-sandwich');
|
||||
//
|
||||
@@ -186,12 +186,12 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @covers \DCarbone\UglyQueue::queueExists
|
||||
// * @uses \DCarbone\UglyQueue
|
||||
// * @covers \Cybercinch\UglyQueue::queueExists
|
||||
// * @uses \Cybercinch\UglyQueue
|
||||
// * @depends testCanInitializeNewUglyQueue
|
||||
// * @param \DCarbone\UglyQueue $uglyQueue
|
||||
// * @param \Cybercinch\UglyQueue $uglyQueue
|
||||
// */
|
||||
// public function testCanDetermineExistenceOfNonExistingQueue(\DCarbone\UglyQueue $uglyQueue)
|
||||
// public function testCanDetermineExistenceOfNonExistingQueue(\Cybercinch\UglyQueue $uglyQueue)
|
||||
// {
|
||||
// $exists = $uglyQueue->queueExists('nasty-sandwich');
|
||||
//
|
||||
@@ -199,12 +199,12 @@ class UglyQueueManagerTest extends PHPUnit_Framework_TestCase
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @covers \DCarbone\UglyQueue::getInitializedQueueList
|
||||
// * @uses \DCarbone\UglyQueue
|
||||
// * @covers \Cybercinch\UglyQueue::getInitializedQueueList
|
||||
// * @uses \Cybercinch\UglyQueue
|
||||
// * @depends testCanInitializeNewUglyQueue
|
||||
// * @param \DCarbone\UglyQueue $uglyQueue
|
||||
// * @param \Cybercinch\UglyQueue $uglyQueue
|
||||
// */
|
||||
// public function testCanGetListOfInitializedQueues(\DCarbone\UglyQueue $uglyQueue)
|
||||
// public function testCanGetListOfInitializedQueues(\Cybercinch\UglyQueue $uglyQueue)
|
||||
// {
|
||||
// $queueList = $uglyQueue->getInitializedQueueList();
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user