for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace OldSound\RabbitMqBundle\Tests\Event;
use OldSound\RabbitMqBundle\Event\OnIdleEvent;
use OldSound\RabbitMqBundle\RabbitMq\Consumer;
use PHPUnit\Framework\TestCase;
/**
* Class OnIdleEventTest
*
* @package OldSound\RabbitMqBundle\Tests\Event
*/
class OnIdleEventTest extends TestCase
{
protected function getConsumer()
return new Consumer(
$this->getMockBuilder('\PhpAmqpLib\Connection\AMQPStreamConnection')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\PhpAmqpLib\Channel\AMQPChannel')
->getMock()
);
}
public function testShouldAllowGetConsumerSetInConstructor()
$consumer = $this->getConsumer();
$event = new OnIdleEvent($consumer);
$this->assertSame($consumer, $event->getConsumer());
public function testShouldSetForceStopToTrueInConstructor()
$this->assertTrue($event->isForceStop());
public function testShouldReturnPreviouslySetForceStop()
//guard
$event->setForceStop(false);
$this->assertFalse($event->isForceStop());