Psr4Test::testNamespaceSlashConfusion()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Corpus\Test\Autoloader;
4
5
use Corpus\Autoloader\Psr4;
6
7
class Psr4Test extends \PHPUnit_Framework_TestCase {
8
9
	private $loader;
10
11
	public function setUp() {
12
		$this->loader = new Psr4('Foo\\Bar', '/vendor/foo.bar/src');
13
	}
14
15 View Code Duplication
	public function testExistingFile() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
		$loader = $this->loader;
17
18
		$actual = $loader('Foo\Bar\ClassName');
19
		$expect = '/vendor/foo.bar/src/ClassName.php';
20
		$this->assertSame($expect, $actual);
21
	}
22
23
	public function testMissingFile() {
24
		$loader = $this->loader;
25
26
		$actual = $loader('No_Vendor\No_Package\NoClass');
27
		$this->assertFalse($actual);
28
	}
29
30
	public function testNamespaceSlashConfusion() {
31
		$loader = $this->loader;
32
33
		$actual = $loader('Foo\BarClassName');
34
		$this->assertFalse($actual);
35
	}
36
37 View Code Duplication
	public function testPathSlashConfusion() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
38
		$loader = new Psr4('Foo\\Bar', '/vendor/foo.bar/src/');
39
40
		$actual = $loader('Foo\Bar\ClassName');
41
		$expect = '/vendor/foo.bar/src/ClassName.php';
42
		$this->assertSame($expect, $actual);
43
	}
44
45
}
46