Example #1
0
 public function testSendRequestWithCustomHeaders()
 {
     if (!API_TEST) {
         $this->markTestSkipped('This test requires API access to execute.');
     }
     $url = TEST_IDENTITY_ENDPOINT;
     $options = ['headers' => ['X-CustomHeaderTest1' => 'hoge', 'X-CustomHeaderTest2' => 'fuga']];
     $res = $this->client->get($url, $options);
     $curl = __get_curl_resource($res);
     $info = curl_getinfo($curl);
     $header = $info['request_header'];
     $this->assertContains("X-CustomHeaderTest1: hoge", $header);
     $this->assertContains("X-CustomHeaderTest2: fuga", $header);
 }
Example #2
0
 public function testConstructorWithHtmlError()
 {
     if (!API_TEST) {
         $this->markTestSkipped('This test requires API access to execute.');
     }
     curl_setopt($this->curl, CURLOPT_URL, TEST_IDENTITY_ENDPOINT . "/foobar");
     try {
         $res = curl_exec($this->curl);
         $r = new Response($this->curl, $res);
     } catch (\Exception $ex) {
         $res = $ex->getLastResponse();
         $curl = __get_curl_resource($res);
         $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
         $this->assertEquals(404, $http_code);
         // OK
         return;
     }
     $this->fail('Unexpected HTTP status code.');
 }