@@ -9,77 +9,77 @@ discard block |
||
9 | 9 | public function setUp() { |
10 | 10 | parent::setUp(); |
11 | 11 | |
12 | - $this->fetch = new Writing_On_GitHub_Fetch_Client( $this->app ); |
|
12 | + $this->fetch = new Writing_On_GitHub_Fetch_Client($this->app); |
|
13 | 13 | $this->api_cache |
14 | - ->shouldReceive( 'fetch_blob' ) |
|
15 | - ->andReturn( false ) |
|
14 | + ->shouldReceive('fetch_blob') |
|
15 | + ->andReturn(false) |
|
16 | 16 | ->byDefault(); |
17 | 17 | } |
18 | 18 | |
19 | 19 | public function test_should_fail_if_missing_token() { |
20 | - delete_option( Base::TOKEN_OPTION_KEY ); |
|
20 | + delete_option(Base::TOKEN_OPTION_KEY); |
|
21 | 21 | |
22 | - $this->assertInstanceOf( 'WP_Error', $error = $this->fetch->tree_recursive() ); |
|
23 | - $this->assertSame( 'missing_token', $error->get_error_code() ); |
|
22 | + $this->assertInstanceOf('WP_Error', $error = $this->fetch->tree_recursive()); |
|
23 | + $this->assertSame('missing_token', $error->get_error_code()); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function test_should_fail_if_missing_repo() { |
27 | - delete_option( Base::REPO_OPTION_KEY ); |
|
27 | + delete_option(Base::REPO_OPTION_KEY); |
|
28 | 28 | |
29 | - $this->assertInstanceOf( 'WP_Error', $error = $this->fetch->tree_recursive() ); |
|
30 | - $this->assertSame( 'missing_repository', $error->get_error_code() ); |
|
29 | + $this->assertInstanceOf('WP_Error', $error = $this->fetch->tree_recursive()); |
|
30 | + $this->assertSame('missing_repository', $error->get_error_code()); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function test_should_fail_if_malformed_repo() { |
34 | 34 | // If you find a particular name passing that shouldn't, |
35 | 35 | // add it to the list here and make it pass. |
36 | - $this->malformed_repo( 'repositoryname' ); |
|
36 | + $this->malformed_repo('repositoryname'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function test_should_return_files_with_tree() { |
40 | 40 | // $this->set_get_refs_heads_master( true ); |
41 | 41 | // $this->set_get_commits( true ); |
42 | - $this->set_get_trees( true, 'master' ); |
|
42 | + $this->set_get_trees(true, 'master'); |
|
43 | 43 | |
44 | - $this->assertCount( 3, $this->fetch->tree_recursive() ); |
|
44 | + $this->assertCount(3, $this->fetch->tree_recursive()); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function test_should_fail_if_cant_fetch_tree() { |
48 | - $this->set_get_trees( false, 'master' ); |
|
48 | + $this->set_get_trees(false, 'master'); |
|
49 | 49 | |
50 | - $this->assertInstanceOf( 'WP_Error', $error = $this->fetch->tree_recursive() ); |
|
51 | - $this->assertSame( '422_unprocessable_entity', $error->get_error_code() ); |
|
50 | + $this->assertInstanceOf('WP_Error', $error = $this->fetch->tree_recursive()); |
|
51 | + $this->assertSame('422_unprocessable_entity', $error->get_error_code()); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function test_should_return_commit_with_blobs_from_cache() { |
55 | - $this->set_get_trees( true, 'master' ); |
|
56 | - $this->set_get_blobs( true ); |
|
55 | + $this->set_get_trees(true, 'master'); |
|
56 | + $this->set_get_blobs(true); |
|
57 | 57 | $this->api_cache |
58 | - ->shouldReceive( 'fetch_blob' ) |
|
59 | - ->times( 3 ) |
|
60 | - ->with( Mockery::anyOf( |
|
58 | + ->shouldReceive('fetch_blob') |
|
59 | + ->times(3) |
|
60 | + ->with(Mockery::anyOf( |
|
61 | 61 | '9fa5c7537f8582b71028ff34b8c20dfd0f3b2a25', |
62 | 62 | '8d9b2e6fd93761211dc03abd71f4a9189d680fd0', |
63 | 63 | '2d73165945b0ccbe4932f1363457986b0ed49f19' |
64 | - ) ) |
|
65 | - ->andReturn( $this->blob ); |
|
64 | + )) |
|
65 | + ->andReturn($this->blob); |
|
66 | 66 | |
67 | - $this->assertCount( 3, $files = $this->fetch->tree_recursive() ); |
|
67 | + $this->assertCount(3, $files = $this->fetch->tree_recursive()); |
|
68 | 68 | |
69 | - foreach ( $files as $file ) { |
|
70 | - $this->assertSame( $this->blob, $this->fetch->blob( $file ) ); |
|
69 | + foreach ($files as $file) { |
|
70 | + $this->assertSame($this->blob, $this->fetch->blob($file)); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | 74 | public function test_should_return_commit_with_no_blobs_if_api_fails() { |
75 | - $this->set_get_trees( true, 'master' ); |
|
76 | - $this->set_get_blobs( false ); |
|
75 | + $this->set_get_trees(true, 'master'); |
|
76 | + $this->set_get_blobs(false); |
|
77 | 77 | |
78 | - $this->assertCount( 3, $files = $this->fetch->tree_recursive() ); |
|
78 | + $this->assertCount(3, $files = $this->fetch->tree_recursive()); |
|
79 | 79 | |
80 | - foreach ( $files as $file ) { |
|
81 | - $this->assertInstanceOf( 'WP_Error', $error = $this->fetch->blob( $file ) ); |
|
82 | - $this->assertSame( '404_not_found', $error->get_error_code() ); |
|
80 | + foreach ($files as $file) { |
|
81 | + $this->assertInstanceOf('WP_Error', $error = $this->fetch->blob($file)); |
|
82 | + $this->assertSame('404_not_found', $error->get_error_code()); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | // } |
160 | 160 | // } |
161 | 161 | |
162 | - protected function malformed_repo( $repo ) { |
|
163 | - update_option( Base::REPO_OPTION_KEY, $repo ); |
|
162 | + protected function malformed_repo($repo) { |
|
163 | + update_option(Base::REPO_OPTION_KEY, $repo); |
|
164 | 164 | |
165 | - $this->assertInstanceOf( 'WP_Error', $error = $this->fetch->tree_recursive() ); |
|
166 | - $this->assertSame( 'malformed_repository', $error->get_error_code() ); |
|
165 | + $this->assertInstanceOf('WP_Error', $error = $this->fetch->tree_recursive()); |
|
166 | + $this->assertSame('malformed_repository', $error->get_error_code()); |
|
167 | 167 | } |
168 | 168 | } |