Пример #1
0
 /**
  * {@inheritDoc}
  *
  * @see \Mcustiel\PowerRoute\Actions\ActionInterface::execute()
  */
 public function execute(TransactionData $transactionData, $argument = null)
 {
     $transactionData->setResponse($this->processAndGetResponse($transactionData, function (TransactionData $transaction, Expectation $expectation) {
         $this->validateRequestOrThrowException($expectation, $this->logger);
         $count = $this->searchForExecutionsCount($expectation);
         $this->logger->debug('Found ' . $count . ' request matching the expectation');
         return $transaction->getResponse()->withStatus(200)->withHeader('Content-Type', 'application/json')->withBody(new StringStream(json_encode(['count' => $count])));
     }));
 }
 /**
  *
  * {@inheritDoc}
  *
  * @see \Mcustiel\PowerRoute\Actions\ActionInterface::execute()
  */
 public function execute(TransactionData $transactionData, $argument = null)
 {
     $this->storage->clearRequests();
     $transactionData->setResponse($transactionData->getResponse()->withStatus(200));
 }
Пример #3
0
 /**
  *
  * {@inheritDoc}
  *
  * @see \Mcustiel\PowerRoute\Actions\ActionInterface::execute()
  */
 public function execute(TransactionData $transactionData, $argument = null)
 {
     $list = json_encode($this->storage->listExpectations());
     $transactionData->setResponse($transactionData->getResponse()->withBody(new StringStream($list))->withHeader('Content-type', 'application/json'));
 }