Completed
Push — master ( c435d5...c435d5 )
by Michael
04:46 queued 02:28
created

IrcColourCodeTest::testColorCodes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 53
Code Lines 47

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 47
nc 1
nop 0
dl 0
loc 53
rs 9.1563
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
4
5
class IrcColourCodeTest 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...
6
{
7
	private $irc;
8
9
	public function setUp(): void
10
	{
11
		$this->irc = new IrcColourCode();
12
	}
0 ignored issues
show
Coding Style introduced by
Expected //end setUp()
Loading history...
13
14
	public function tearDown(): void
15
	{
16
		$this->irc = null;
17
	}
0 ignored issues
show
Coding Style introduced by
Expected //end tearDown()
Loading history...
18
19
	public function testColorCodes()
20
	{
21
		$i = $this->irc;
22
23
		$this->assertEquals($i::BOLD, "\x02");
24
		$this->assertEquals($i::ITALIC, "\x09");
25
		$this->assertEquals($i::STRIKE, "\x13");
26
		$this->assertEquals($i::UNDERLINE, "\x15");
27
		$this->assertEquals($i::UNDERLINE2, "\x1f");
28
		$this->assertEquals($i::REVERSE, "\x16");
29
		$this->assertEquals($i::RESET, "\x0f");
30
31
		$this->assertEquals($i::WHITE, "\x0300");
32
		$this->assertEquals($i::BLACK, "\x0301");
33
		$this->assertEquals($i::DARK_BLUE, "\x0302");
34
		$this->assertEquals($i::DARK_GREEN, "\x0303");
35
		$this->assertEquals($i::RED, "\x0304");
36
		$this->assertEquals($i::DARK_RED, "\x0305");
37
		$this->assertEquals($i::DARK_VIOLET, "\x0306");
38
		$this->assertEquals($i::ORANGE, "\x0307");
39
		$this->assertEquals($i::YELLOW, "\x0308");
40
		$this->assertEquals($i::LIGHT_GREEN, "\x0309");
41
		$this->assertEquals($i::CYAN, "\x0310");
42
		$this->assertEquals($i::LIGHT_CYAN, "\x0311");
43
		$this->assertEquals($i::BLUE, "\x0312");
44
		$this->assertEquals($i::VIOLET, "\x0313");
45
		$this->assertEquals($i::DARK_GREY, "\x0314");
46
		$this->assertEquals($i::LIGHT_GREY, "\x0315");
47
48
		$this->assertNotEquals($i::BOLD, "\x021");
49
		$this->assertNotEquals($i::ITALIC, "\x091");
50
		$this->assertNotEquals($i::STRIKE, "\x131");
51
		$this->assertNotEquals($i::UNDERLINE, "\x151");
52
		$this->assertNotEquals($i::UNDERLINE2, "\x1f1");
53
		$this->assertNotEquals($i::REVERSE, "\x161");
54
		$this->assertNotEquals($i::RESET, "\x0f1");
55
56
		$this->assertNotEquals($i::WHITE, "\x03001");
57
		$this->assertNotEquals($i::BLACK, "\x03011");
58
		$this->assertNotEquals($i::DARK_BLUE, "\x03021");
59
		$this->assertNotEquals($i::DARK_GREEN, "\x03031");
60
		$this->assertNotEquals($i::RED, "\x03041");
61
		$this->assertNotEquals($i::DARK_RED, "\x03051");
62
		$this->assertNotEquals($i::DARK_VIOLET, "\x03061");
63
		$this->assertNotEquals($i::ORANGE, "\x03071");
64
		$this->assertNotEquals($i::YELLOW, "\x03081");
65
		$this->assertNotEquals($i::LIGHT_GREEN, "\x03091");
66
		$this->assertNotEquals($i::CYAN, "\x03101");
67
		$this->assertNotEquals($i::LIGHT_CYAN, "\x03111");
68
		$this->assertNotEquals($i::BLUE, "\x03121");
69
		$this->assertNotEquals($i::VIOLET, "\x03131");
70
		$this->assertNotEquals($i::DARK_GREY, "\x03141");
71
		$this->assertNotEquals($i::LIGHT_GREY, "\x03151");
72
	}
0 ignored issues
show
Coding Style introduced by
Expected //end testColorCodes()
Loading history...
73
74
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
75