1 | <?php |
||
8 | class RepresentationTest extends KintTestCase |
||
9 | { |
||
10 | public function testConstruct() |
||
11 | { |
||
12 | $r = new Representation('This is a label'); |
||
|
|||
13 | $this->assertEquals('This is a label', $r->label); |
||
14 | $this->assertEquals('this_is_a_label', $r->getName()); |
||
15 | |||
16 | $r = new Representation('This is a label', 'this_is_a_name'); |
||
17 | $this->assertEquals('This is a label', $r->label); |
||
18 | $this->assertEquals('this_is_a_name', $r->getName()); |
||
19 | |||
20 | $r = new Representation('Test # 3'); |
||
21 | $this->assertEquals('Test # 3', $r->label); |
||
22 | $this->assertEquals('test_3', $r->getName()); |
||
23 | } |
||
24 | |||
25 | public function testGetLabel() |
||
35 | |||
36 | public function testSetName() |
||
37 | { |
||
38 | $r = new Representation('Test'); |
||
39 | $this->assertEquals('test', $r->getName()); |
||
40 | |||
41 | $r->setName('Test this string!'); |
||
42 | $this->assertEquals('test_this_string_', $r->getName()); |
||
43 | |||
44 | $r->setName('UPPERCASE HOLDS NO POWER HERE'); |
||
45 | $this->assertEquals('uppercase_holds_no_power_here', $r->getName()); |
||
46 | |||
47 | $r->setName('Multiple ! # () @!$#%@#$% special characters'); |
||
48 | $this->assertEquals('multiple_special_characters', $r->getName()); |
||
49 | |||
50 | $r->setName('But numbers work like 123'); |
||
51 | $this->assertEquals('but_numbers_work_like_123', $r->getName()); |
||
52 | } |
||
53 | |||
54 | public function testLabelIsImplicit() |
||
61 | } |
||
62 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.