private function _call($method, $uri, $params = [])
    {
        if (! str_begins_with('http', $uri)) {
            $client = new MenuCaller();

            return $client->setPath($uri)->setMethod($method)->addParams($params)->send();
        }

        try {
            $client = new Client();
            $uri = $this->_prepareURI($uri);

            if (! empty($this->_cookies)) {
                $domain = str_replace('http://', '', $GLOBALS['base_url']);
                $domain = str_replace('https://', '', $domain);
                $cookieJar = CookieJar::fromArray($this->_cookies, $domain);
                $params['cookies'] = $cookieJar;
            }

            return new TestResponse($client->request($method, $uri, $params));
        } catch (\GuzzleHttp\Exception\GuzzleException $exception) {
            PHPUnit::fail("Failed to send $method request to $uri. ".$exception->getMessage());
        }

        return null;
    }
private function _call($method, $uri, $params = [])
    {
        if (! str_begins_with('http', $uri)) {
            $client = new MenuCaller();

            return $client->setPath($uri)->setMethod($method)->addParams($params)->send();
        }

        try {
            $client = new Client();
            $uri = $this->_prepareURI($uri);

            if (! empty($this->_cookies)) {
                $domain = str_replace('http://', '', $GLOBALS['base_url']);
                $domain = str_replace('https://', '', $domain);
                $cookieJar = CookieJar::fromArray($this->_cookies, $domain);
                $params['cookies'] = $cookieJar;
            }

            return new TestResponse($client->request($method, $uri, $params));
        } catch (\GuzzleHttp\Exception\GuzzleException $exception) {
            PHPUnit::fail("Failed to send $method request to $uri. ".$exception->getMessage());
        }

        return null;
    }
private function _call ( $ method , $ uri , $ params = [ ] ) { if ( ! str_begins_with ( 'http' , $ uri ) ) { $ client = new MenuCaller ( ) ; return $ client -> setPath ( $ uri ) -> setMethod ( $ method ) -> addParams ( $ params ) -> send ( ) ; } try { $ client = new Client ( ) ; $ uri = $ this -> _prepareURI ( $ uri ) ; if ( ! empty ( $ this -> _cookies ) ) { $ domain = str_replace ( 'http://' , '' , $ GLOBALS [ 'base_url' ] ) ; $ domain = str_replace ( 'https://' , '' , $ domain ) ; $ cookieJar = CookieJar :: fromArray ( $ this -> _cookies , $ domain ) ; $ params [ 'cookies' ] = $ cookieJar ; } return new TestResponse ( $ client -> request ( $ method , $ uri , $ params ) ) ; } catch ( \ GuzzleHttp \ Exception \ GuzzleException $ exception ) { PHPUnit :: fail ( "Failed to send $method request to $uri. " . $ exception -> getMessage ( ) ) ; } return null ; }
Sends the request.

@param string $method
@param string $uri
@params array $params

@throws \Exception
@return TestResponse
Sends the request .