diff options
Diffstat (limited to 'lib/facebook-graph-sdk/tests/Fixtures')
14 files changed, 569 insertions, 0 deletions
diff --git a/lib/facebook-graph-sdk/tests/Fixtures/FakeGraphApiForResumableUpload.php b/lib/facebook-graph-sdk/tests/Fixtures/FakeGraphApiForResumableUpload.php new file mode 100644 index 0000000..1c2d0f8 --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/FakeGraphApiForResumableUpload.php @@ -0,0 +1,111 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +namespace Facebook\Tests\Fixtures; + +use Facebook\Http\GraphRawResponse; +use Facebook\HttpClients\FacebookHttpClientInterface; + +class FakeGraphApiForResumableUpload implements FacebookHttpClientInterface +{ + public $transferCount = 0; + private $respondWith = 'SUCCESS'; + + public function failOnStart() + { + $this->respondWith = 'FAIL_ON_START'; + } + + public function failOnTransfer() + { + $this->respondWith = 'FAIL_ON_TRANSFER'; + } + + public function send($url, $method, $body, array $headers, $timeOut) + { + // Could be start, transfer or finish + if (strpos($body, 'transfer') !== false) { + return $this->respondTransfer(); + } elseif (strpos($body, 'finish') !== false) { + return $this->respondFinish(); + } + + return $this->respondStart(); + } + + private function respondStart() + { + if ($this->respondWith == 'FAIL_ON_START') { + return new GraphRawResponse( + "HTTP/1.1 500 OK\r\nFoo: Bar", + '{"error":{"message":"Error validating access token: Session has expired on Monday, ' . + '10-Aug-15 01:00:00 PDT. The current time is Monday, 10-Aug-15 01:14:23 PDT.",' . + '"type":"OAuthException","code":190,"error_subcode":463}}' + ); + } + + return new GraphRawResponse( + "HTTP/1.1 200 OK\r\nFoo: Bar", + '{"video_id":"1337","start_offset":"0","end_offset":"20","upload_session_id":"42"}' + ); + } + + private function respondTransfer() + { + if ($this->respondWith == 'FAIL_ON_TRANSFER') { + return new GraphRawResponse( + "HTTP/1.1 500 OK\r\nFoo: Bar", + '{"error":{"message":"There was a problem uploading your video. Please try uploading it again.",' . + '"type":"FacebookApiException","code":6000,"error_subcode":1363019}}' + ); + } + + switch ($this->transferCount) { + case 0: + $data = ['start_offset' => 20, 'end_offset' => 40]; + break; + case 1: + $data = ['start_offset' => 40, 'end_offset' => 50]; + break; + default: + $data = ['start_offset' => 50, 'end_offset' => 50]; + break; + } + + $this->transferCount++; + + return new GraphRawResponse( + "HTTP/1.1 200 OK\r\nFoo: Bar", + json_encode($data) + ); + } + + private function respondFinish() + { + return new GraphRawResponse( + "HTTP/1.1 200 OK\r\nFoo: Bar", + '{"success":true}' + ); + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/FooBarPseudoRandomStringGenerator.php b/lib/facebook-graph-sdk/tests/Fixtures/FooBarPseudoRandomStringGenerator.php new file mode 100644 index 0000000..17448b6 --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/FooBarPseudoRandomStringGenerator.php @@ -0,0 +1,34 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface; + +class FooBarPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface +{ + public function getPseudoRandomString($length) + { + return 'csprs123'; + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/FooClientInterface.php b/lib/facebook-graph-sdk/tests/Fixtures/FooClientInterface.php new file mode 100644 index 0000000..f4548d8 --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/FooClientInterface.php @@ -0,0 +1,38 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\Http\GraphRawResponse; +use Facebook\HttpClients\FacebookHttpClientInterface; + +class FooClientInterface implements FacebookHttpClientInterface +{ + public function send($url, $method, $body, array $headers, $timeOut) + { + return new GraphRawResponse( + "HTTP/1.1 1337 OK\r\nDate: Mon, 19 May 2014 18:37:17 GMT", + '{"data":[{"id":"123","name":"Foo"},{"id":"1337","name":"Bar"}]}' + ); + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/FooPersistentDataInterface.php b/lib/facebook-graph-sdk/tests/Fixtures/FooPersistentDataInterface.php new file mode 100644 index 0000000..5ff5793 --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/FooPersistentDataInterface.php @@ -0,0 +1,38 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\PersistentData\PersistentDataInterface; + +class FooPersistentDataInterface implements PersistentDataInterface +{ + public function get($key) + { + return 'foo'; + } + + public function set($key, $value) + { + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/FooPseudoRandomStringGenerator.php b/lib/facebook-graph-sdk/tests/Fixtures/FooPseudoRandomStringGenerator.php new file mode 100644 index 0000000..d5a94d6 --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/FooPseudoRandomStringGenerator.php @@ -0,0 +1,34 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface; + +class FooPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface +{ + public function getPseudoRandomString($length) + { + return 'csprs123'; + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/FooRedirectLoginOAuth2Client.php b/lib/facebook-graph-sdk/tests/Fixtures/FooRedirectLoginOAuth2Client.php new file mode 100644 index 0000000..2a2aeed --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/FooRedirectLoginOAuth2Client.php @@ -0,0 +1,35 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\Authentication\AccessToken; +use Facebook\Authentication\OAuth2Client; + +class FooRedirectLoginOAuth2Client extends OAuth2Client +{ + public function getAccessTokenFromCode($code, $redirectUri = '', $machineId = null) + { + return new AccessToken('foo_token_from_code|' . $code . '|' . $redirectUri); + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/FooSignedRequestHelper.php b/lib/facebook-graph-sdk/tests/Fixtures/FooSignedRequestHelper.php new file mode 100644 index 0000000..9131631 --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/FooSignedRequestHelper.php @@ -0,0 +1,34 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\Helpers\FacebookSignedRequestFromInputHelper; + +class FooSignedRequestHelper extends FacebookSignedRequestFromInputHelper +{ + public function getRawSignedRequest() + { + return null; + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/FooSignedRequestHelperFacebookClient.php b/lib/facebook-graph-sdk/tests/Fixtures/FooSignedRequestHelperFacebookClient.php new file mode 100644 index 0000000..0b08b8c --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/FooSignedRequestHelperFacebookClient.php @@ -0,0 +1,41 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\FacebookClient; +use Facebook\FacebookRequest; +use Facebook\FacebookResponse; + +class FooSignedRequestHelperFacebookClient extends FacebookClient +{ + public function sendRequest(FacebookRequest $request) + { + $params = $request->getParams(); + $rawResponse = json_encode([ + 'access_token' => 'foo_access_token_from:' . $params['code'], + ]); + + return new FacebookResponse($request, $rawResponse, 200); + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/FooUrlDetectionInterface.php b/lib/facebook-graph-sdk/tests/Fixtures/FooUrlDetectionInterface.php new file mode 100644 index 0000000..8ee70c3 --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/FooUrlDetectionInterface.php @@ -0,0 +1,34 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\Url\UrlDetectionInterface; + +class FooUrlDetectionInterface implements UrlDetectionInterface +{ + public function getCurrentUrl() + { + return 'https://foo.bar'; + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/MyFooBarPseudoRandomStringGenerator.php b/lib/facebook-graph-sdk/tests/Fixtures/MyFooBarPseudoRandomStringGenerator.php new file mode 100644 index 0000000..8c39c8a --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/MyFooBarPseudoRandomStringGenerator.php @@ -0,0 +1,31 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\PseudoRandomString\PseudoRandomStringGeneratorTrait; + +class MyFooBarPseudoRandomStringGenerator +{ + use PseudoRandomStringGeneratorTrait; +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/MyFooBatchClientHandler.php b/lib/facebook-graph-sdk/tests/Fixtures/MyFooBatchClientHandler.php new file mode 100644 index 0000000..4a4c9cb --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/MyFooBatchClientHandler.php @@ -0,0 +1,38 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\Http\GraphRawResponse; +use Facebook\HttpClients\FacebookHttpClientInterface; + +class MyFooBatchClientHandler implements FacebookHttpClientInterface +{ + public function send($url, $method, $body, array $headers, $timeOut) + { + return new GraphRawResponse( + "HTTP/1.1 200 OK\r\nDate: Mon, 19 May 2014 18:37:17 GMT", + '[{"code":"123","body":"Foo"},{"code":"1337","body":"Bar"}]' + ); + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/MyFooClientHandler.php b/lib/facebook-graph-sdk/tests/Fixtures/MyFooClientHandler.php new file mode 100644 index 0000000..346da9e --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/MyFooClientHandler.php @@ -0,0 +1,38 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\Http\GraphRawResponse; +use Facebook\HttpClients\FacebookHttpClientInterface; + +class MyFooClientHandler implements FacebookHttpClientInterface +{ + public function send($url, $method, $body, array $headers, $timeOut) + { + return new GraphRawResponse( + "HTTP/1.1 200 OK\r\nDate: Mon, 19 May 2014 18:37:17 GMT", + '{"data":[{"id":"123","name":"Foo"},{"id":"1337","name":"Bar"}]}' + ); + } +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/MyFooGraphNode.php b/lib/facebook-graph-sdk/tests/Fixtures/MyFooGraphNode.php new file mode 100644 index 0000000..40d3a91 --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/MyFooGraphNode.php @@ -0,0 +1,33 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\GraphNodes\GraphNode; + +class MyFooGraphNode extends GraphNode +{ + protected static $graphObjectMap = [ + 'foo_object' => '\Facebook\Tests\Fixtures\MyFooSubClassGraphNode', + ]; +} diff --git a/lib/facebook-graph-sdk/tests/Fixtures/MyFooSubClassGraphNode.php b/lib/facebook-graph-sdk/tests/Fixtures/MyFooSubClassGraphNode.php new file mode 100644 index 0000000..d03b308 --- /dev/null +++ b/lib/facebook-graph-sdk/tests/Fixtures/MyFooSubClassGraphNode.php @@ -0,0 +1,30 @@ +<?php +/** + * 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 + * form for use in connection with the web services and APIs provided by + * Facebook. + * + * As with any software that integrates with the Facebook platform, your use + * of this software is subject to the Facebook Developer Principles and + * Policies [http://developers.facebook.com/policy/]. This copyright notice + * shall be included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +namespace Facebook\Tests\Fixtures; + +use Facebook\GraphNodes\GraphNode; + +class MyFooSubClassGraphNode extends GraphNode +{ +} |