public function testCanSetResultAndDoesNotStopPropagation() { $command = $this->getMock('GuzzleHttp\\Command\\CommandInterface'); $client = $this->getMock('GuzzleHttp\\Command\\ServiceClientInterface'); $trans = new CommandTransaction($client, $command); $result = null; $event = new ProcessEvent($trans); $event->setResult('foo'); $this->assertSame('foo', $event->getResult()); $this->assertSame('foo', $trans->getResult()); $this->assertFalse($event->isPropagationStopped()); }
public function testCanMutateData() { $client = $this->getMockForAbstractClass('GuzzleHttp\\Command\\ServiceClientInterface'); $command = new Command('foo', []); $trans = new CommandTransaction($client, $command, ['foo' => 'bar']); $request = new Request('GET', 'http://foo.com'); $trans->setRequest($request); $this->assertSame($request, $trans->getRequest()); $response = new Response(200); $trans->setResponse($response); $this->assertSame($response, $trans->getResponse()); $trans->setResult('foo'); $this->assertSame('foo', $trans->getResult()); $e = new \Exception('foo'); $trans->setException($e); $this->assertSame($e, $trans->getException()); }
/** * Returns the result of the command if it was intercepted. * * @return mixed|null */ public function getResult() { return $this->trans->getResult(); }