Example #1
0
 public function testJob_buryBuries_kickKicks()
 {
     $this->beanie->producer()->put('test');
     $job = $this->beanie->worker()->reserve();
     $job->bury();
     $jobStats = $job->stats();
     $this->assertEquals($jobStats['state'], 'buried');
     $this->beanie->manager($this->serverName)->tubes()[0]->kick();
     $jobStats = $job->stats();
     $this->assertEquals($jobStats['state'], 'ready');
     $job->delete();
 }
Example #2
0
 public function testManager_retrievesServer_getsManager()
 {
     $serverName = 'test';
     $managerMock = $this->getMockBuilder(Manager::class)->disableOriginalConstructor()->getMock();
     $serverMock = $this->getMockBuilder(Server::class)->disableOriginalConstructor()->setMethods(['getManager'])->getMock();
     $serverMock->expects($this->once())->method('getManager')->willReturn($managerMock);
     /** @var \PHPUnit_Framework_MockObject_MockObject|Pool $poolMock */
     $poolMock = $this->getMockBuilder(Pool::class)->disableOriginalConstructor()->setMethods(['getServer'])->getMock();
     $poolMock->expects($this->once())->method('getServer')->willReturn($serverMock);
     $beanie = new Beanie($poolMock);
     $manager = $beanie->manager($serverName);
     $this->assertSame($managerMock, $manager);
 }