Definition at line 5 of file ClientTest.php.
◆ testCreateCurlSettingsArrayGET()
Sabre\HTTP\ClientTest::testCreateCurlSettingsArrayGET |
( |
| ) |
|
Definition at line 7 of file ClientTest.php.
References $client, $request, and Sabre\HTTP\Version\VERSION.
10 $client->addCurlSetting(CURLOPT_POSTREDIR, 0);
12 $request =
new Request(
'GET',
'http://example.org/', [
'X-Foo' =>
'bar']);
15 CURLOPT_RETURNTRANSFER =>
true,
16 CURLOPT_HEADER =>
true,
17 CURLOPT_POSTREDIR => 0,
18 CURLOPT_HTTPHEADER => [
'X-Foo: bar'],
19 CURLOPT_NOBODY =>
false,
20 CURLOPT_URL =>
'http://example.org/',
21 CURLOPT_CUSTOMREQUEST =>
'GET',
22 CURLOPT_POSTFIELDS =>
'',
24 CURLOPT_USERAGENT =>
'sabre-http/' .
Version::VERSION .
' (http://sabre.io/)',
29 if (defined(
'HHVM_VERSION') ===
false) {
30 $settings[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
31 $settings[CURLOPT_REDIR_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
35 $this->assertEquals($settings,
$client->createCurlSettingsArray(
$request));
foreach($paths as $path) $request
if($_SERVER['argc']< 4) $client
const VERSION
Full version number.
◆ testCreateCurlSettingsArrayGETAfterHEAD()
Sabre\HTTP\ClientTest::testCreateCurlSettingsArrayGETAfterHEAD |
( |
| ) |
|
Definition at line 68 of file ClientTest.php.
References $client, $request, and Sabre\HTTP\Version\VERSION.
71 $request =
new Request(
'HEAD',
'http://example.org/', [
'X-Foo' =>
'bar']);
79 $request =
new Request(
'GET',
'http://example.org/', [
'X-Foo' =>
'bar']);
82 CURLOPT_CUSTOMREQUEST =>
'GET',
83 CURLOPT_RETURNTRANSFER =>
true,
84 CURLOPT_HEADER =>
true,
85 CURLOPT_HTTPHEADER => [
'X-Foo: bar'],
86 CURLOPT_NOBODY =>
false,
87 CURLOPT_URL =>
'http://example.org/',
88 CURLOPT_POSTFIELDS =>
'',
90 CURLOPT_USERAGENT =>
'sabre-http/' .
Version::VERSION .
' (http://sabre.io/)',
95 if (defined(
'HHVM_VERSION') ===
false) {
96 $settings[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
97 $settings[CURLOPT_REDIR_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
100 $this->assertEquals($settings,
$client->createCurlSettingsArray(
$request));
foreach($paths as $path) $request
if($_SERVER['argc']< 4) $client
const VERSION
Full version number.
◆ testCreateCurlSettingsArrayHEAD()
Sabre\HTTP\ClientTest::testCreateCurlSettingsArrayHEAD |
( |
| ) |
|
Definition at line 39 of file ClientTest.php.
References $client, $request, and Sabre\HTTP\Version\VERSION.
42 $request =
new Request(
'HEAD',
'http://example.org/', [
'X-Foo' =>
'bar']);
46 CURLOPT_RETURNTRANSFER =>
true,
47 CURLOPT_HEADER =>
true,
48 CURLOPT_NOBODY =>
true,
49 CURLOPT_CUSTOMREQUEST =>
'HEAD',
50 CURLOPT_HTTPHEADER => [
'X-Foo: bar'],
51 CURLOPT_URL =>
'http://example.org/',
52 CURLOPT_POSTFIELDS =>
'',
54 CURLOPT_USERAGENT =>
'sabre-http/' .
Version::VERSION .
' (http://sabre.io/)',
59 if (defined(
'HHVM_VERSION') ===
false) {
60 $settings[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
61 $settings[CURLOPT_REDIR_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
64 $this->assertEquals($settings,
$client->createCurlSettingsArray(
$request));
foreach($paths as $path) $request
if($_SERVER['argc']< 4) $client
const VERSION
Full version number.
◆ testCreateCurlSettingsArrayPUTStream()
Sabre\HTTP\ClientTest::testCreateCurlSettingsArrayPUTStream |
( |
| ) |
|
Definition at line 104 of file ClientTest.php.
References $client, $h, $request, and Sabre\HTTP\Version\VERSION.
108 $h =
fopen(
'php://memory',
'r+');
110 $request =
new Request(
'PUT',
'http://example.org/', [
'X-Foo' =>
'bar'],
$h);
113 CURLOPT_RETURNTRANSFER =>
true,
114 CURLOPT_HEADER =>
true,
116 CURLOPT_INFILE =>
$h,
117 CURLOPT_NOBODY =>
false,
118 CURLOPT_CUSTOMREQUEST =>
'PUT',
119 CURLOPT_HTTPHEADER => [
'X-Foo: bar'],
120 CURLOPT_URL =>
'http://example.org/',
121 CURLOPT_USERAGENT =>
'sabre-http/' .
Version::VERSION .
' (http://sabre.io/)',
126 if (defined(
'HHVM_VERSION') ===
false) {
127 $settings[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
128 $settings[CURLOPT_REDIR_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
131 $this->assertEquals($settings,
$client->createCurlSettingsArray(
$request));
foreach($paths as $path) $request
if($_SERVER['argc']< 4) $client
const VERSION
Full version number.
◆ testCreateCurlSettingsArrayPUTString()
Sabre\HTTP\ClientTest::testCreateCurlSettingsArrayPUTString |
( |
| ) |
|
Definition at line 135 of file ClientTest.php.
References $client, $request, and Sabre\HTTP\Version\VERSION.
138 $request =
new Request(
'PUT',
'http://example.org/', [
'X-Foo' =>
'bar'],
'boo');
141 CURLOPT_RETURNTRANSFER =>
true,
142 CURLOPT_HEADER =>
true,
143 CURLOPT_NOBODY =>
false,
144 CURLOPT_POSTFIELDS =>
'boo',
145 CURLOPT_CUSTOMREQUEST =>
'PUT',
146 CURLOPT_HTTPHEADER => [
'X-Foo: bar'],
147 CURLOPT_URL =>
'http://example.org/',
148 CURLOPT_USERAGENT =>
'sabre-http/' .
Version::VERSION .
' (http://sabre.io/)',
153 if (defined(
'HHVM_VERSION') ===
false) {
154 $settings[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
155 $settings[CURLOPT_REDIR_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
158 $this->assertEquals($settings,
$client->createCurlSettingsArray(
$request));
foreach($paths as $path) $request
if($_SERVER['argc']< 4) $client
const VERSION
Full version number.
◆ testDoRequest()
Sabre\HTTP\ClientTest::testDoRequest |
( |
| ) |
|
Definition at line 320 of file ClientTest.php.
References $client, $request, and $response.
323 $request =
new Request(
'GET',
'http://example.org/');
324 $client->on(
'curlExec',
function(&$return) {
326 $return =
"HTTP/1.1 200 OK\r\nHeader1:Val1\r\n\r\nFoo";
329 $client->on(
'curlStuff',
function(&$return) {
342 $this->assertEquals(200,
$response->getStatus());
343 $this->assertEquals([
'Header1' => [
'Val1']],
$response->getHeaders());
344 $this->assertEquals(
'Foo',
$response->getBodyAsString());
foreach($paths as $path) $request
if($_SERVER['argc']< 4) $client
◆ testDoRequestCurlError()
Sabre\HTTP\ClientTest::testDoRequestCurlError |
( |
| ) |
|
Definition at line 348 of file ClientTest.php.
References $client, $request, and $response.
351 $request =
new Request(
'GET',
'http://example.org/');
352 $client->on(
'curlExec',
function(&$return) {
357 $client->on(
'curlStuff',
function(&$return) {
369 $this->fail(
'This should have thrown an exception');
370 }
catch (ClientException $e) {
371 $this->assertEquals(1, $e->getCode());
372 $this->assertEquals(
'Curl error', $e->getMessage());
foreach($paths as $path) $request
if($_SERVER['argc']< 4) $client
◆ testHttpErrorException()
Sabre\HTTP\ClientTest::testHttpErrorException |
( |
| ) |
|
◆ testParseCurlError()
Sabre\HTTP\ClientTest::testParseCurlError |
( |
| ) |
|
◆ testParseCurlResult()
Sabre\HTTP\ClientTest::testParseCurlResult |
( |
| ) |
|
◆ testSend()
Sabre\HTTP\ClientTest::testSend |
( |
| ) |
|
◆ testSendClientError()
Sabre\HTTP\ClientTest::testSendClientError |
( |
| ) |
|
Definition at line 177 of file ClientTest.php.
References $client, $request, and $response.
180 $request =
new Request(
'GET',
'http://example.org/');
183 throw new ClientException(
'aaah', 1);
186 $client->on(
'exception',
function() use (&$called) {
192 $this->fail(
'send() should have thrown an exception');
193 }
catch (ClientException $e) {
196 $this->assertTrue($called);
foreach($paths as $path) $request
if($_SERVER['argc']< 4) $client
◆ testSendHttpError()
Sabre\HTTP\ClientTest::testSendHttpError |
( |
| ) |
|
Definition at line 200 of file ClientTest.php.
References $client, $request, and $response.
203 $request =
new Request(
'GET',
'http://example.org/');
209 $client->on(
'error',
function() use (&$called) {
212 $client->on(
'error:404',
function() use (&$called) {
217 $this->assertEquals(2, $called);
foreach($paths as $path) $request
if($_SERVER['argc']< 4) $client
◆ testSendRetry()
Sabre\HTTP\ClientTest::testSendRetry |
( |
| ) |
|
Definition at line 221 of file ClientTest.php.
References $client, $request, $response, and $retry.
224 $request =
new Request(
'GET',
'http://example.org/');
245 $this->assertEquals(3, $called);
246 $this->assertEquals(2, $errorCalled);
247 $this->assertEquals(200,
$response->getStatus());
foreach($paths as $path) $request
if($_SERVER['argc']< 4) $client
The documentation for this class was generated from the following file: