Scalr\Tests\Service\CloudStack\CloudStackTestCase::getQueryClientResponseMock PHP Метод

getQueryClientResponseMock() публичный Метод

Gets QueryClientResponse Mock.
public getQueryClientResponseMock ( string $body, $command, integer $responseCode = null ) : QueryClientResponse
$body string
$responseCode integer optional The code of the http response
Результат QueryClientResponse Returns response mock object
    public function getQueryClientResponseMock($body, $command, $responseCode = null)
    {
        $response = $this->getMock(self::CLOUDSTACK_NS . '\\Client\\QueryClientResponse', array('getContent', 'getResponseCode'), array($this->getMock('\\http\\Client\\Response'), $command));
        if ($responseCode === null) {
            if (preg_match('/errorresponse/i', $body)) {
                $responseCode = 500;
            } else {
                $responseCode = 200;
            }
        }
        $response->expects($this->any())->method('getResponseCode')->will($this->returnValue($responseCode));
        $response->expects($this->any())->method('getContent')->will($this->returnValue($body));
        return $response;
    }