public function sendData($data) { $httpRequest = RequestFactory::make($this->getEndpointUrl($data), $this->getHttpRequestData($data), $this->getHttpRequestQueryParameters($data), $this->getHttpRequestHeaders($data), $this->getHttpRequestMethod($data)); $httpResponse = $this->sendHttpMessage($httpRequest, false); $processedHttpResponse = $this->processHttpResponse($httpResponse); $this->response = $this->createResponse(ResponseParser::extractDataFromResponse($processedHttpResponse), $processedHttpResponse->getStatusCode()); return $this->response; }
/** * @expectedException InvalidArgumentException */ public function testInvalidFormat() { $data = ['a' => ['b' => 'c']]; $uri = 'https://user@www.example.com/some/path?key=value#bla'; $headers = ['content-type' => ' text/html ; charset = ISO-8859-1']; $request = RequestFactory::make($uri, $data, ['other' => 5], $headers, 'PATCH'); }
public function setUp() { $this->message = RequestFactory::make('http://nonexistent.localhost/path', null, ['param' => 'value']); $this->request = new ExtendedAbstractRequestForTesting($this->getHttpClient(), $this->getHttpRequest()); $this->items = $items = [['name' => 'Some Article', 'identifier' => 'A001', 'price' => '10.00', 'description' => 'Just article for testing', 'quantity' => 2, 'discountPercent' => '10', 'taxPercent' => '20', 'flags' => 5], ['name' => 'Another Article', 'identifier' => 'A002', 'price' => '10.00', 'description' => 'Another article for testing']]; }