public function testConsumeChecksController()
 {
     $queue = $this->createMock(Queue::class);
     $this->controller->expects($this->once())->method('doStop')->willReturn(true);
     $subject = $this->buildSubject(['invoke']);
     $subject->consume($queue);
     $subject->expects($this->never())->method('invoke');
 }
 /**
  * @param bool $doStop
  * @param bool $valid
  * @dataProvider getBooleanArray
  */
 public function testValid($doStop, $valid)
 {
     $this->scheduleIterator->expects($this->any())->method('valid')->willReturn($valid);
     $this->controller->expects($this->any())->method('doStop')->willReturn($doStop);
     if ($doStop) {
         $this->assertEquals(false, $this->subject->valid());
     } else {
         $this->assertEquals($valid, $this->subject->valid());
     }
 }
 public function testConsumeChecksController()
 {
     $queue = 'foobar';
     $message = $this->createMock(MessageInterface::class);
     $iterator = new TestIterator([$message, $message]);
     $this->backendProvider->expects($this->once())->method('getBackend')->with($queue)->willReturn($this->backend);
     $this->backend->expects($this->any())->method('getIterator')->willReturn($iterator);
     $this->controller->expects($this->any())->method('doStop')->willReturn(true);
     $this->backend->expects($this->never())->method('handle');
     $this->subject->consume($queue);
 }
예제 #4
0
 public function testDoExitControllerReturnsTrue()
 {
     $this->controller->expects($this->any())->method('doStop')->willReturn(true);
     $this->assertTrue($this->subject->doStop());
     $this->assertEquals(Status::CANCELLED(), $this->job->getStatus());
 }