Completed
Branch master (0dbf7d)
by Simon
03:37
created

IrcColourCodeTest::testColorCodes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 54
Code Lines 48

Duplication

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