public function createResponse(Expectation $expectation, TransactionData $transactionData) { $responseConfig = $expectation->getResponse(); $httpResponse = $transactionData->getResponse(); $httpResponse = $this->getResponseWithBody($expectation, $httpResponse, $transactionData->getRequest()); $httpResponse = $this->getResponseWithStatusCode($responseConfig, $httpResponse); $httpResponse = $this->getResponseWithHeaders($responseConfig, $httpResponse); $this->processDelay($responseConfig); return $httpResponse; }
/** * * {@inheritDoc} * * @see \Mcustiel\PowerRoute\Actions\ActionInterface::execute() */ public function execute(TransactionData $transactionData, $argument = null) { $this->storage->clearRequests(); $transactionData->setResponse($transactionData->getResponse()->withStatus(200)); }
/** * * {@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')); }