예제 #1
0
 /**
  * @throws \Exception if one has been queued.
  * @throws \OutOfBoundsException if the queue is empty.
  */
 public function onPrepare(PrepareEvent $event)
 {
     if (!($result = array_shift($this->queue))) {
         throw new \OutOfBoundsException('Result mock queue is empty');
     } elseif ($result instanceof \Exception) {
         throw $result;
     } else {
         $event->setResult($result);
     }
 }
예제 #2
0
 public function testCanSetResultAndStopPropagation()
 {
     $command = $this->getMock('GuzzleHttp\\Command\\CommandInterface');
     $client = $this->getMock('GuzzleHttp\\Command\\ServiceClientInterface');
     $trans = new CommandTransaction($client, $command);
     $event = new PrepareEvent($trans);
     $event->setResult('foo');
     $this->assertEquals('foo', $event->getResult());
     $this->assertTrue($event->isPropagationStopped());
 }