Пример #1
0
 public function testCanCreateWithResult()
 {
     $command = $this->getMock('GuzzleHttp\\Command\\CommandInterface');
     $client = $this->getMock('GuzzleHttp\\Command\\ServiceClientInterface');
     $trans = new CommandTransaction($client, $command);
     $trans->setResult('foo');
     $event = new ProcessEvent($trans);
     $this->assertSame('foo', $event->getResult());
 }
 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());
 }