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

testWhenFileFetcherThrowsException_emptyStringIsReturned()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
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