diff options
author | emkael <emkael@tlen.pl> | 2018-04-26 01:00:12 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-04-26 01:00:12 +0200 |
commit | 4b8a9a5189a625bf99fedec7fd31f6e146410a14 (patch) | |
tree | a29759d5f0f0c29f07c89c59f6b5cf38407d1470 /lib/facebook-graph-sdk/tests/HttpClients/FacebookCurlHttpClientTest.php | |
parent | ab82beef33f4c196383a81213dcdff4ebe9447ae (diff) |
Update FB API library
Diffstat (limited to 'lib/facebook-graph-sdk/tests/HttpClients/FacebookCurlHttpClientTest.php')
-rw-r--r-- | lib/facebook-graph-sdk/tests/HttpClients/FacebookCurlHttpClientTest.php | 61 |
1 files changed, 5 insertions, 56 deletions
diff --git a/lib/facebook-graph-sdk/tests/HttpClients/FacebookCurlHttpClientTest.php b/lib/facebook-graph-sdk/tests/HttpClients/FacebookCurlHttpClientTest.php index 4cf31d3..47cc027 100644 --- a/lib/facebook-graph-sdk/tests/HttpClients/FacebookCurlHttpClientTest.php +++ b/lib/facebook-graph-sdk/tests/HttpClients/FacebookCurlHttpClientTest.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2014 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to * use, copy, modify, and distribute this software in source code or binary @@ -41,8 +41,11 @@ class FacebookCurlHttpClientTest extends AbstractTestHttpClient const CURL_VERSION_STABLE = 0x072400; const CURL_VERSION_BUGGY = 0x071400; - public function setUp() + protected function setUp() { + if (!extension_loaded('curl')) { + $this->markTestSkipped('cURL must be installed to test cURL client handler.'); + } $this->curlMock = m::mock('Facebook\HttpClients\FacebookCurl'); $this->curlClient = new FacebookCurlHttpClient($this->curlMock); } @@ -147,15 +150,6 @@ class FacebookCurlHttpClientTest extends AbstractTestHttpClient public function testIsolatesTheHeaderAndBody() { $this->curlMock - ->shouldReceive('getinfo') - ->with(CURLINFO_HEADER_SIZE) - ->once() - ->andReturn(strlen($this->fakeRawHeader)); - $this->curlMock - ->shouldReceive('version') - ->once() - ->andReturn(['version_number' => self::CURL_VERSION_STABLE]); - $this->curlMock ->shouldReceive('exec') ->once() ->andReturn($this->fakeRawHeader . $this->fakeRawBody); @@ -171,15 +165,6 @@ class FacebookCurlHttpClientTest extends AbstractTestHttpClient { $rawHeader = $this->fakeRawProxyHeader . $this->fakeRawHeader; $this->curlMock - ->shouldReceive('getinfo') - ->with(CURLINFO_HEADER_SIZE) - ->once() - ->andReturn(mb_strlen($rawHeader)); - $this->curlMock - ->shouldReceive('version') - ->once() - ->andReturn(['version_number' => self::CURL_VERSION_STABLE]); - $this->curlMock ->shouldReceive('exec') ->once() ->andReturn($rawHeader . $this->fakeRawBody); @@ -195,15 +180,6 @@ class FacebookCurlHttpClientTest extends AbstractTestHttpClient { $rawHeader = $this->fakeRawProxyHeader . $this->fakeRawHeader; $this->curlMock - ->shouldReceive('getinfo') - ->with(CURLINFO_HEADER_SIZE) - ->once() - ->andReturn(mb_strlen($this->fakeRawHeader)); // Mimic bug that doesn't count proxy header - $this->curlMock - ->shouldReceive('version') - ->once() - ->andReturn(['version_number' => self::CURL_VERSION_BUGGY]); - $this->curlMock ->shouldReceive('exec') ->once() ->andReturn($rawHeader . $this->fakeRawBody); @@ -219,15 +195,6 @@ class FacebookCurlHttpClientTest extends AbstractTestHttpClient { $rawHeader = $this->fakeRawProxyHeader2 . $this->fakeRawHeader; $this->curlMock - ->shouldReceive('getinfo') - ->with(CURLINFO_HEADER_SIZE) - ->once() - ->andReturn(mb_strlen($this->fakeRawHeader)); // Mimic bug that doesn't count proxy header - $this->curlMock - ->shouldReceive('version') - ->once() - ->andReturn(['version_number' => self::CURL_VERSION_BUGGY]); - $this->curlMock ->shouldReceive('exec') ->once() ->andReturn($rawHeader . $this->fakeRawBody); @@ -243,15 +210,6 @@ class FacebookCurlHttpClientTest extends AbstractTestHttpClient { $rawHeader = $this->fakeRawRedirectHeader . $this->fakeRawHeader; $this->curlMock - ->shouldReceive('getinfo') - ->with(CURLINFO_HEADER_SIZE) - ->once() - ->andReturn(mb_strlen($rawHeader)); - $this->curlMock - ->shouldReceive('version') - ->once() - ->andReturn(['version_number' => self::CURL_VERSION_STABLE]); - $this->curlMock ->shouldReceive('exec') ->once() ->andReturn($rawHeader . $this->fakeRawBody); @@ -282,15 +240,6 @@ class FacebookCurlHttpClientTest extends AbstractTestHttpClient ->once() ->andReturn(null); $this->curlMock - ->shouldReceive('getinfo') - ->with(CURLINFO_HEADER_SIZE) - ->once() - ->andReturn(mb_strlen($this->fakeRawHeader)); - $this->curlMock - ->shouldReceive('version') - ->once() - ->andReturn(['version_number' => self::CURL_VERSION_STABLE]); - $this->curlMock ->shouldReceive('close') ->once() ->andReturn(null); |