Completed
Push — master ( 00092a...39103d )
by wiese
86:17 queued 21:06
created

FilePrefixerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGivenNoFilePrefixes_fileNameIsNotChanged() 0 4 1
A testGivenPrefixes_prefixIsPrependedToFilename() 0 4 1
A testGivenPrefixesWithPath_prefixIsPrependedToFilename() 0 4 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\Tests\Unit\Presentation;
6
7
use WMDE\Fundraising\Frontend\Presentation\FilePrefixer;
8
9
class FilePrefixerTest extends \PHPUnit\Framework\TestCase {
10
11
	public function testGivenNoFilePrefixes_fileNameIsNotChanged(): void {
12
		$prefixer = new FilePrefixer( '' );
13
		$this->assertSame( 'wmde.js', $prefixer->prefixFile( 'wmde.js' ) );
14
	}
15
16
	public function testGivenPrefixes_prefixIsPrependedToFilename(): void {
17
		$prefixer = new FilePrefixer( 'badcaffee' );
18
		$this->assertSame( 'badcaffee.wmde.js', $prefixer->prefixFile( 'wmde.js' ) );
19
	}
20
21
	public function testGivenPrefixesWithPath_prefixIsPrependedToFilename(): void {
22
		$prefixer = new FilePrefixer( 'badcaffee' );
23
		$this->assertSame( 'res/js/badcaffee.wmde.js', $prefixer->prefixFile( 'res/js/wmde.js' ) );
24
	}
25
26
}
27