public function send()
    {
        $allowed_methods = ['POST', 'GET', 'PUT', 'PATCH', 'DELETE'];
        if (! in_array($this->method, $allowed_methods)) {
            throw new \Exception("Unknown method $this->method.");
        }
        $_SERVER['REQUEST_METHOD'] = $this->method;
        $this->injectParams();

        list($status, $value, $headers) = $this->execute();

        drupal_add_http_header('Content-Type', null);

        return new TestResponseMock([
            'status' => $status,
            'body' => $value,
            'headers' => [
                    'Cache-Control' => 'no-cache, must-revalidate',
                    'Connection' => 'Keep-Alive',
                    'Content-Language' => 'en',
                    'Content-Type' => 'text/html; charset=utf-8',
                    'Date' => gmdate('D, d M Y H:is e'),
                    'Expires' => gmdate('D, d M Y H:is e'),
                    'Keep-Alive' => 'timeout=5, max=100',
                    'Server' => 'Apache/2.4.29 (Unix) PHP/'.phpversion(),
                    'Transfer-Encoding' => 'chunked',
                    'X-Content-Type-Options' => 'nosniff',
                    'X-Frame-Options' => 'SAMEORIGIN',
                    'X-Generator' => 'Drupal 7 (http://drupal.org)',
                ] + $headers,
        ]);
    }
public function send()
    {
        $allowed_methods = ['POST', 'GET', 'PUT', 'PATCH', 'DELETE'];
        if (! in_array($this->method, $allowed_methods)) {
            throw new \Exception("Unknown method $this->method.");
        }
        $_SERVER['REQUEST_METHOD'] = $this->method;
        $this->injectParams();

        list($status, $value, $headers) = $this->execute();

        drupal_add_http_header('Content-Type', null);

        return new TestResponseMock([
            'status' => $status,
            'body' => $value,
            'headers' => [
                    'Cache-Control' => 'no-cache, must-revalidate',
                    'Connection' => 'Keep-Alive',
                    'Content-Language' => 'en',
                    'Content-Type' => 'text/html; charset=utf-8',
                    'Date' => gmdate('D, d M Y H:is e'),
                    'Expires' => gmdate('D, d M Y H:is e'),
                    'Keep-Alive' => 'timeout=5, max=100',
                    'Server' => 'Apache/2.4.29 (Unix) PHP/'.phpversion(),
                    'Transfer-Encoding' => 'chunked',
                    'X-Content-Type-Options' => 'nosniff',
                    'X-Frame-Options' => 'SAMEORIGIN',
                    'X-Generator' => 'Drupal 7 (http://drupal.org)',
                ] + $headers,
        ]);
    }
public function send ( ) { $ allowed_methods = [ 'POST' , 'GET' , 'PUT' , 'PATCH' , 'DELETE' ] ; if ( ! in_array ( $ this -> method , $ allowed_methods ) ) { throw new \ Exception ( "Unknown method $this->method." ) ; } $ _SERVER [ 'REQUEST_METHOD' ] = $ this -> method ; $ this -> injectParams ( ) ; list ( $ status , $ value , $ headers ) = $ this -> execute ( ) ; drupal_add_http_header ( 'Content-Type' , null ) ; return new TestResponseMock ( [ 'status' => $ status , 'body' => $ value , 'headers' => [ 'Cache-Control' => 'no-cache, must-revalidate' , 'Connection' => 'Keep-Alive' , 'Content-Language' => 'en' , 'Content-Type' => 'text/html; charset=utf-8' , 'Date' => gmdate ( 'D, d M Y H:is e' ) , 'Expires' => gmdate ( 'D, d M Y H:is e' ) , 'Keep-Alive' => 'timeout=5, max=100' , 'Server' => 'Apache/2.4.29 (Unix) PHP/' . phpversion ( ) , 'Transfer-Encoding' => 'chunked' , 'X-Content-Type-Options' => 'nosniff' , 'X-Frame-Options' => 'SAMEORIGIN' , 'X-Generator' => 'Drupal 7 (http://drupal.org)' , ] + $ headers , ] ) ; }
Creates a mock HTTP response.

@return \StatonLab\TripalTestSuite\Mocks\TestResponseMock
@throws \Exception
Creates a mock HTTP response .