function it_should_be_able_to_register_a_response(Client $client, RequestEvent $requestEvent, ResultInterface $result, ResponseEvent $responseEvent) { $debugData = ['request' => ['headers' => 'SoapRequestHeader', 'body' => '<?xml version="1.0" encoding="UTF-8"?><body>SoapRequestBody</body>'], 'response' => ['headers' => 'SoapResponseHeader', 'body' => '<?xml version="1.0" encoding="UTF-8"?><body>SoapResponseBody</body>']]; $client->debugLastSoapRequest()->willReturn($debugData); $responseEvent->getResponse()->willReturn($result); $responseEvent->getClient()->willReturn($client); $this->onClientRequest($requestEvent); $this->onClientResponse($responseEvent); $this->getCalls()->shouldHaveCount(1); }
function it_should_parse_the_debug_array(ResponseEvent $responseEvent, RequestEvent $requestEvent, ResultInterface $result, Client $client) { $debugData = ['request' => ['headers' => 'SoapRequestHeader', 'body' => '<?xml version="1.0" encoding="UTF-8"?><body>SoapRequestBody</body>'], 'response' => ['headers' => 'SoapResponseHeader', 'body' => '<?xml version="1.0" encoding="UTF-8"?><body>SoapResponseBody</body>']]; $client->debugLastSoapRequest()->willReturn($debugData); $responseEvent->getResponse()->willReturn($result); $responseEvent->getClient()->willReturn($client); $this->setRequest($requestEvent); $this->setResponse($responseEvent); $this->getResponseHeaders()->shouldBe($debugData['response']['headers']); $this->getResponseBody()->shouldStartWith('<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL . '<body>SoapResponseBody</body>'); $this->getRequestHeaders()->shouldBe($debugData['request']['headers']); $this->getRequestBody()->shouldStartWith('<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL . '<body>SoapRequestBody</body>'); }