Test Failed
Push — master ( c73643...f19b3f )
by Jeroen De
07:49
created

GitHubFetcherTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testWhenFileFetcherThrowsException_emptyStringIsReturned() 0 7 1
A testWhenRepoNotInWhitelist_emptyStringIsReturned() 0 7 1
1
<?php
2
3
namespace GitHub\Tests\Phpunit;
4
5
use FileFetcher\StubFileFetcher;
6
use FileFetcher\ThrowingFileFetcher;
7
use GitHub\GitHubFetcher;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * @covers GitHub\GitHubFetcher
12
 *
13
 * @licence GNU GPL v2+
14
 * @author Jeroen De Dauw < [email protected] >
15
 */
16
class GitHubFetcherTest extends TestCase {
17
18
	public function testWhenFileFetcherThrowsException_emptyStringIsReturned() {
19
		$this->assertSame(
20
			'',
21
			( new GitHubFetcher( new ThrowingFileFetcher(), '', [] ) )
22
				->getFileContent( 'JeroenDeDauw/GitHub', 'master', 'README.md' )
23
		);
24
	}
25
26
	public function testWhenRepoNotInWhitelist_emptyStringIsReturned() {
27
		$this->assertSame(
28
			'',
29
			( new GitHubFetcher( new StubFileFetcher( 'kittens' ), '', [ 'JeroenDeDauw/Maps' ] ) )
30
				->getFileContent( 'JeroenDeDauw/GitHub', 'master', 'README.md' )
31
		);
32
	}
33
34
}
35