Test Failed
Push — master ( e06943...75ce46 )
by Federico
02:37
created

ModuleTest::testAddFilesRequired()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
	declare( strict_types = 1 );
3
4
	use PHPUnit\Framework\TestCase;
5
6
	final class ModuleTest extends TestCase {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
		public function testAddFile() {
8
			$this->expectException(InvalidArgumentException::class);
9
			$module = new Module();
10
			$module->addFile(123);
11
		}
12
		public function testAddFileRequired() {
13
			$this->expectException(InvalidArgumentException::class);
14
			$module = new Module();
15
			$module->addFileRequired(123);
16
		}
17
		public function testAddFiles() {
18
			$this->expectException(InvalidArgumentException::class);
19
			$module = new Module();
20
			$module->addFiles("/file.php");
21
		}
22
		public function testAddFilesRequired() {
23
			$this->expectException(InvalidArgumentException::class);
24
			$module = new Module();
25
			$module->addFilesRequired("/file.php");
26
		}
27
		public function testAddModuleClass() {
28
			$this->expectException(InvalidArgumentException::class);
29
			$module = new Module();
30
			$module->addModule(123);
31
		}
32
		public function testAddModuleNoModule() {
33
			$this->expectException(InvalidArgumentException::class);
34
			$module = new Module();
35
			$module->addModule((object)[1,2,3]);
36
		}
37
		public function testAddModules() {
38
			$this->expectException(InvalidArgumentException::class);
39
			$module = new Module();
40
			$module->addModules("Module");
41
		}
42
		public function testGetCss() {
43
			$module = new Module();
44
			$module->addFiles(["1.css","2.js","3.css","4.js"]);
45
			$this->assertEquals(["1.css","3.css"], $module->getCss());
46
		}
47
		public function testGetJs() {
48
			$module = new Module();
49
			$module->addFiles(["1.css","2.js","3.css","4.js"]);
50
			$this->assertEquals(["2.js","4.js"], $module->getJs());
51
		}
52
	}
53
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
54