public function testCall() { $request = new Request('foo'); $this->syncDriver->expects($this->once())->method('call')->with(new Identity('bug'), $request); $this->asyncDriver->expects($this->never())->method('call'); $this->splitDriver->call(new Identity('bug'), $request); }
/** * Make sure publish is logged. */ public function testCall() { $this->innerDriver->expects(self::once())->method('call')->willReturn(new Promise(function () { return new Response(''); })); $this->logger->expects(self::exactly(2))->method('debug'); $this->driver->call(new Identity(''), new Request(''))->resolve(); }
/** * Endpoint should delegate RPC calls to the driver. */ public function testCall() { $request = new Request(''); $promise = new Promise(function () { }); $this->driver->expects($this->once())->method('call')->with($this->identity, $request)->willReturn($promise); $returned = $this->endpoint->call($request); $this->assertSame($promise, $returned); }
public function testCall() { $this->driverA->expects(self::any())->method('supports')->willReturnCallback(function ($schema) { return $schema == 'foo'; }); $this->driverA->expects(self::once())->method('call')->with(self::anything(), new Request('foo')); $this->driverB->expects(self::any())->method('supports')->willReturnCallback(function ($schema) { return $schema == 'bar'; }); $this->driverB->expects(self::once())->method('call')->with(self::anything(), new Request('bar')); $this->arrayDriver->call(new Identity('foo', ['foo://localhost']), new Request('foo')); $this->arrayDriver->call(new Identity('bar', ['bar://localhost']), new Request('bar')); }
/** * 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 Promise($resolver)); $this->driver->call(new Identity('foo'), $this->request); }