Skip to content

Commit 4499845

Browse files
committed
Fix: Extract class definitions, indentation
1 parent 7379ae6 commit 4499845

20 files changed

+470
-143
lines changed

tests/FacebookClientTest.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,13 @@
2929
use Facebook\FacebookRequest;
3030
use Facebook\FacebookBatchRequest;
3131
use Facebook\FacebookClient;
32-
use Facebook\Http\GraphRawResponse;
33-
use Facebook\HttpClients\FacebookHttpClientInterface;
3432
use Facebook\FileUpload\FacebookFile;
3533
use Facebook\FileUpload\FacebookVideo;
3634
// These are needed when you uncomment the HTTP clients below.
3735
use Facebook\HttpClients\FacebookCurlHttpClient;
3836
use Facebook\HttpClients\FacebookGuzzleHttpClient;
3937
use Facebook\HttpClients\FacebookStreamHttpClient;
4038

41-
class MyFooClientHandler implements FacebookHttpClientInterface
42-
{
43-
public function send($url, $method, $body, array $headers, $timeOut)
44-
{
45-
return new GraphRawResponse(
46-
"HTTP/1.1 200 OK\r\nDate: Mon, 19 May 2014 18:37:17 GMT",
47-
'{"data":[{"id":"123","name":"Foo"},{"id":"1337","name":"Bar"}]}'
48-
);
49-
}
50-
}
51-
52-
class MyFooBatchClientHandler implements FacebookHttpClientInterface
53-
{
54-
public function send($url, $method, $body, array $headers, $timeOut)
55-
{
56-
return new GraphRawResponse(
57-
"HTTP/1.1 200 OK\r\nDate: Mon, 19 May 2014 18:37:17 GMT",
58-
'[{"code":"123","body":"Foo"},{"code":"1337","body":"Bar"}]'
59-
);
60-
}
61-
}
62-
6339
class FacebookClientTest extends \PHPUnit_Framework_TestCase
6440
{
6541
/**

tests/FacebookTest.php

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -25,55 +25,11 @@
2525

2626
use Facebook\Facebook;
2727
use Facebook\FacebookClient;
28-
use Facebook\Http\GraphRawResponse;
29-
use Facebook\HttpClients\FacebookHttpClientInterface;
30-
use Facebook\PersistentData\PersistentDataInterface;
31-
use Facebook\Url\UrlDetectionInterface;
32-
use Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface;
3328
use Facebook\FacebookRequest;
3429
use Facebook\Authentication\AccessToken;
3530
use Facebook\GraphNodes\GraphEdge;
3631
use Facebook\Tests\FakeGraphApi\FakeGraphApiForResumableUpload;
3732

38-
class FooClientInterface implements FacebookHttpClientInterface
39-
{
40-
public function send($url, $method, $body, array $headers, $timeOut)
41-
{
42-
return new GraphRawResponse(
43-
"HTTP/1.1 1337 OK\r\nDate: Mon, 19 May 2014 18:37:17 GMT",
44-
'{"data":[{"id":"123","name":"Foo"},{"id":"1337","name":"Bar"}]}'
45-
);
46-
}
47-
}
48-
49-
class FooPersistentDataInterface implements PersistentDataInterface
50-
{
51-
public function get($key)
52-
{
53-
return 'foo';
54-
}
55-
56-
public function set($key, $value)
57-
{
58-
}
59-
}
60-
61-
class FooUrlDetectionInterface implements UrlDetectionInterface
62-
{
63-
public function getCurrentUrl()
64-
{
65-
return 'https://foo.bar';
66-
}
67-
}
68-
69-
class FooBarPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
70-
{
71-
public function getPseudoRandomString($length)
72-
{
73-
return 'csprs123';
74-
}
75-
}
76-
7733
class FacebookTest extends \PHPUnit_Framework_TestCase
7834
{
7935
protected $config = [

tests/FakeGraphApi/FakeGraphApiForResumableUpload.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,26 @@ private function respondStart()
5858
{
5959
if ($this->respondWith == 'FAIL_ON_START') {
6060
return new GraphRawResponse(
61-
"HTTP/1.1 500 OK\r\nFoo: Bar",
62-
'{"error":{"message":"Error validating access token: Session has expired on Monday, ' .
63-
'10-Aug-15 01:00:00 PDT. The current time is Monday, 10-Aug-15 01:14:23 PDT.",' .
64-
'"type":"OAuthException","code":190,"error_subcode":463}}'
61+
"HTTP/1.1 500 OK\r\nFoo: Bar",
62+
'{"error":{"message":"Error validating access token: Session has expired on Monday, ' .
63+
'10-Aug-15 01:00:00 PDT. The current time is Monday, 10-Aug-15 01:14:23 PDT.",' .
64+
'"type":"OAuthException","code":190,"error_subcode":463}}'
6565
);
6666
}
6767

6868
return new GraphRawResponse(
69-
"HTTP/1.1 200 OK\r\nFoo: Bar",
70-
'{"video_id":"1337","start_offset":"0","end_offset":"20","upload_session_id":"42"}'
69+
"HTTP/1.1 200 OK\r\nFoo: Bar",
70+
'{"video_id":"1337","start_offset":"0","end_offset":"20","upload_session_id":"42"}'
7171
);
7272
}
7373

7474
private function respondTransfer()
7575
{
7676
if ($this->respondWith == 'FAIL_ON_TRANSFER') {
7777
return new GraphRawResponse(
78-
"HTTP/1.1 500 OK\r\nFoo: Bar",
79-
'{"error":{"message":"There was a problem uploading your video. Please try uploading it again.",' .
80-
'"type":"FacebookApiException","code":6000,"error_subcode":1363019}}'
78+
"HTTP/1.1 500 OK\r\nFoo: Bar",
79+
'{"error":{"message":"There was a problem uploading your video. Please try uploading it again.",' .
80+
'"type":"FacebookApiException","code":6000,"error_subcode":1363019}}'
8181
);
8282
}
8383

@@ -96,16 +96,16 @@ private function respondTransfer()
9696
$this->transferCount++;
9797

9898
return new GraphRawResponse(
99-
"HTTP/1.1 200 OK\r\nFoo: Bar",
100-
json_encode($data)
99+
"HTTP/1.1 200 OK\r\nFoo: Bar",
100+
json_encode($data)
101101
);
102102
}
103103

104104
private function respondFinish()
105105
{
106106
return new GraphRawResponse(
107-
"HTTP/1.1 200 OK\r\nFoo: Bar",
108-
'{"success":true}'
107+
"HTTP/1.1 200 OK\r\nFoo: Bar",
108+
'{"success":true}'
109109
);
110110
}
111111
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright 2016 Facebook, Inc.
4+
*
5+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
6+
* use, copy, modify, and distribute this software in source code or binary
7+
* form for use in connection with the web services and APIs provided by
8+
* Facebook.
9+
*
10+
* As with any software that integrates with the Facebook platform, your use
11+
* of this software is subject to the Facebook Developer Principles and
12+
* Policies [http://developers.facebook.com/policy/]. This copyright notice
13+
* shall be included in all copies or substantial portions of the software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+
* DEALINGS IN THE SOFTWARE.
22+
*
23+
*/
24+
namespace Facebook\Tests;
25+
26+
use Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface;
27+
28+
class FooBarPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
29+
{
30+
public function getPseudoRandomString($length)
31+
{
32+
return 'csprs123';
33+
}
34+
}

tests/FooClientInterface.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
/**
3+
* Copyright 2016 Facebook, Inc.
4+
*
5+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
6+
* use, copy, modify, and distribute this software in source code or binary
7+
* form for use in connection with the web services and APIs provided by
8+
* Facebook.
9+
*
10+
* As with any software that integrates with the Facebook platform, your use
11+
* of this software is subject to the Facebook Developer Principles and
12+
* Policies [http://developers.facebook.com/policy/]. This copyright notice
13+
* shall be included in all copies or substantial portions of the software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+
* DEALINGS IN THE SOFTWARE.
22+
*
23+
*/
24+
namespace Facebook\Tests;
25+
26+
use Facebook\Http\GraphRawResponse;
27+
use Facebook\HttpClients\FacebookHttpClientInterface;
28+
29+
class FooClientInterface implements FacebookHttpClientInterface
30+
{
31+
public function send($url, $method, $body, array $headers, $timeOut)
32+
{
33+
return new GraphRawResponse(
34+
"HTTP/1.1 1337 OK\r\nDate: Mon, 19 May 2014 18:37:17 GMT",
35+
'{"data":[{"id":"123","name":"Foo"},{"id":"1337","name":"Bar"}]}'
36+
);
37+
}
38+
}

tests/FooPersistentDataInterface.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
/**
3+
* Copyright 2016 Facebook, Inc.
4+
*
5+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
6+
* use, copy, modify, and distribute this software in source code or binary
7+
* form for use in connection with the web services and APIs provided by
8+
* Facebook.
9+
*
10+
* As with any software that integrates with the Facebook platform, your use
11+
* of this software is subject to the Facebook Developer Principles and
12+
* Policies [http://developers.facebook.com/policy/]. This copyright notice
13+
* shall be included in all copies or substantial portions of the software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+
* DEALINGS IN THE SOFTWARE.
22+
*
23+
*/
24+
namespace Facebook\Tests;
25+
26+
use Facebook\PersistentData\PersistentDataInterface;
27+
28+
class FooPersistentDataInterface implements PersistentDataInterface
29+
{
30+
public function get($key)
31+
{
32+
return 'foo';
33+
}
34+
35+
public function set($key, $value)
36+
{
37+
}
38+
}

tests/FooUrlDetectionInterface.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright 2016 Facebook, Inc.
4+
*
5+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
6+
* use, copy, modify, and distribute this software in source code or binary
7+
* form for use in connection with the web services and APIs provided by
8+
* Facebook.
9+
*
10+
* As with any software that integrates with the Facebook platform, your use
11+
* of this software is subject to the Facebook Developer Principles and
12+
* Policies [http://developers.facebook.com/policy/]. This copyright notice
13+
* shall be included in all copies or substantial portions of the software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+
* DEALINGS IN THE SOFTWARE.
22+
*
23+
*/
24+
namespace Facebook\Tests;
25+
26+
use Facebook\Url\UrlDetectionInterface;
27+
28+
class FooUrlDetectionInterface implements UrlDetectionInterface
29+
{
30+
public function getCurrentUrl()
31+
{
32+
return 'https://foo.bar';
33+
}
34+
}

tests/GraphNodes/GraphNodeFactoryTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,6 @@
2727
use Facebook\FacebookRequest;
2828
use Facebook\FacebookResponse;
2929
use Facebook\GraphNodes\GraphNodeFactory;
30-
use Facebook\GraphNodes\GraphNode;
31-
32-
class MyFooSubClassGraphNode extends GraphNode
33-
{
34-
}
35-
36-
class MyFooGraphNode extends GraphNode
37-
{
38-
protected static $graphObjectMap = [
39-
'foo_object' => '\Facebook\Tests\GraphNodes\MyFooSubClassGraphNode',
40-
];
41-
}
4230

4331
class GraphNodeFactoryTest extends \PHPUnit_Framework_TestCase
4432
{

tests/GraphNodes/MyFooGraphNode.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright 2016 Facebook, Inc.
4+
*
5+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
6+
* use, copy, modify, and distribute this software in source code or binary
7+
* form for use in connection with the web services and APIs provided by
8+
* Facebook.
9+
*
10+
* As with any software that integrates with the Facebook platform, your use
11+
* of this software is subject to the Facebook Developer Principles and
12+
* Policies [http://developers.facebook.com/policy/]. This copyright notice
13+
* shall be included in all copies or substantial portions of the software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+
* DEALINGS IN THE SOFTWARE.
22+
*
23+
*/
24+
namespace Facebook\Tests\GraphNodes;
25+
26+
use Facebook\GraphNodes\GraphNode;
27+
28+
class MyFooGraphNode extends GraphNode
29+
{
30+
protected static $graphObjectMap = [
31+
'foo_object' => '\Facebook\Tests\GraphNodes\MyFooSubClassGraphNode',
32+
];
33+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright 2016 Facebook, Inc.
4+
*
5+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
6+
* use, copy, modify, and distribute this software in source code or binary
7+
* form for use in connection with the web services and APIs provided by
8+
* Facebook.
9+
*
10+
* As with any software that integrates with the Facebook platform, your use
11+
* of this software is subject to the Facebook Developer Principles and
12+
* Policies [http://developers.facebook.com/policy/]. This copyright notice
13+
* shall be included in all copies or substantial portions of the software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+
* DEALINGS IN THE SOFTWARE.
22+
*
23+
*/
24+
namespace Facebook\Tests\GraphNodes;
25+
26+
use Facebook\GraphNodes\GraphNode;
27+
28+
class MyFooSubClassGraphNode extends GraphNode
29+
{
30+
}

0 commit comments

Comments
 (0)