예제 #1
0
 function testCreateCurlSettingsArrayPUTString()
 {
     $client = new ClientMock();
     $request = new Request('PUT', 'http://example.org/', ['X-Foo' => 'bar'], 'boo');
     $settings = [CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_NOBODY => false, CURLOPT_POSTFIELDS => 'boo', CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => ['X-Foo: bar'], CURLOPT_URL => 'http://example.org/'];
     // FIXME: CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS are currently unsupported by HHVM
     // at least if this unit test fails in the future we know it is :)
     if (defined('HHVM_VERSION') === false) {
         $settings[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
         $settings[CURLOPT_REDIR_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
     }
     $this->assertEquals($settings, $client->createCurlSettingsArray($request));
 }
예제 #2
0
 function testCreateCurlSettingsArrayPUTString()
 {
     $client = new ClientMock();
     $request = new Request('PUT', 'http://example.org/', ['X-Foo' => 'bar'], 'boo');
     $this->assertEquals([CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_POSTFIELDS => 'boo', CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_HTTPHEADER => ['X-Foo: bar'], CURLOPT_URL => 'http://example.org/'], $client->createCurlSettingsArray($request));
 }