public function testCall() { $request = new Request('foo', '1'); $this->syncDriver->expects($this->once())->method('call')->with(new Location('bug'), $request); $this->asyncDriver->expects($this->never())->method('call'); $this->splitDriver->call(new Location('bug'), $request); }
/** * Endpoint should delegate RPC calls to the driver. */ public function testCall() { $request = new Request('', null); $promise = new Response\Promise(function () { }); $this->driver->expects($this->once())->method('call')->with('calc', $request)->willReturn($promise); $returned = $this->endpoint->call($request); $this->assertSame($promise, $returned); }
public function testCallSkipDriverWhenThresholdIsReached() { $this->primaryDriver->expects($this->exactly(5))->method('call')->willThrowException(new \Exception('Error')); $this->secondaryDriver->expects($this->exactly(6))->method('call'); for ($tries = 0; $tries < 6; ++$tries) { $this->fallbackDriver->call(new Location('foo'), new Request('foo', '0')); } }
/** * Make sure ReplyEvent is not dispatched if response is not resolved. */ public function testReplyNotDispatchedWhenResponseNotResolved() { $listener = $this->getCallableMock(); $listener->expects($this->never())->method('__invoke'); $resolver = $this->getCallableMock(); $resolver->expects($this->never())->method('__invoke'); $this->driver->getDispatcher()->addListener(self::REPLY_EVENT_NAME, $listener); $this->innerDriver->expects($this->once())->method('call')->willReturn(new Response\Promise($resolver)); $this->driver->call(new Location('foo'), $this->request); }
/** * Service bus should broadcast messages using given driver. */ public function testBroadcast() { $request = new Request('', null); $this->driver->expects($this->once())->method('broadcast')->with($request); $this->serviceBus->broadcast($request); }