VCR\Util\SoapClient::__doRequest PHP Method

__doRequest() public method

Requests will be intercepted if the library hook is enabled.
public __doRequest ( string $request, string $location, string $action, integer $version, integer $one_way ) : string
$request string The XML SOAP request.
$location string The URL to request.
$action string The SOAP action.
$version integer The SOAP version.
$one_way integer If one_way is set to 1, this method returns nothing. Use this where a response is not expected.
return string The XML SOAP response.
    public function __doRequest($request, $location, $action, $version, $one_way = 0)
    {
        // Save a copy of the request, not the request itself -- see issue #153
        $this->request = (string) $request;
        $soapHook = $this->getLibraryHook();
        if ($soapHook->isEnabled()) {
            $response = $soapHook->doRequest($request, $location, $action, $version, $one_way, $this->options);
        } else {
            $response = $this->realDoRequest($request, $location, $action, $version, $one_way);
        }
        $this->response = $response;
        return $one_way ? null : $response;
    }

Usage Example

Exemplo n.º 1
0
 public function testDoRequestExpectingException()
 {
     $exception = '\\LogicException';
     $hook = $this->getLibraryHookMock(true);
     $hook->expects($this->once())->method('doRequest')->will($this->throwException(new \LogicException('hook not enabled.')));
     $client = new SoapClient(self::WSDL);
     $client->setLibraryHook($hook);
     $this->setExpectedException($exception);
     $client->__doRequest('Knorx ist groß', self::WSDL, self::ACTION, SOAP_1_2);
 }