ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSystemStyleIconColorSetTest Class Reference
+ Inheritance diagram for ilSystemStyleIconColorSetTest:
+ Collaboration diagram for ilSystemStyleIconColorSetTest:

Public Member Functions

 testConstruct ()
 
 testAddColor ()
 
 testGetInvalidId ()
 
 testDoesColorExist ()
 
 testMergeColorSet ()
 
 testGetColorsSortedAsArray ()
 
 testAsArray ()
 
 testAsString ()
 

Detailed Description

Member Function Documentation

◆ testAddColor()

ilSystemStyleIconColorSetTest::testAddColor ( )

Definition at line 22 of file ilSystemStyleIconColorSetTest.php.

22  {
23  $color1 = new ilSystemStyleIconColor("id1","name","FF0000","description");
24  $color2 = new ilSystemStyleIconColor("id2","name","FF0000","description");
25 
26  $set = new ilSystemStyleIconColorSet();
27 
28  $this->assertEquals([],$set->getColors());
29 
30  $set->addColor($color1);
31 
32  $this->assertEquals(1,count($set->getColors()));
33  $this->assertEquals($color1,$set->getColorById("id1"));
34 
35  $set->addColor($color2);
36  $this->assertEquals(2,count($set->getColors()));
37  $this->assertEquals($color1,$set->getColorById("id1"));
38  $this->assertEquals($color2,$set->getColorById("id2"));
39 
40  $set->addColor($color2);
41  $this->assertEquals(2,count($set->getColors()));
42  $this->assertEquals($color1,$set->getColorById("id1"));
43  $this->assertEquals($color2,$set->getColorById("id2"));
44  }

◆ testAsArray()

ilSystemStyleIconColorSetTest::testAsArray ( )

Definition at line 124 of file ilSystemStyleIconColorSetTest.php.

References $black, $blue, $green, $red, and $white.

124  {
125  $white = new ilSystemStyleIconColor("id1","name","FFFFFF","description");
126  $black = new ilSystemStyleIconColor("id2","name","000000","description");
127  $grey = new ilSystemStyleIconColor("id3","name","AAAAAA","description");
128 
129  $red = new ilSystemStyleIconColor("id4","name","FF0000","description");
130  $green = new ilSystemStyleIconColor("id5","name","00FF00","description");
131  $blue = new ilSystemStyleIconColor("id6","name","0000FF","description");
132 
133  $as_array = ["id1","id2","id3","id4","id5","id6"];
134 
135  $set1 = new ilSystemStyleIconColorSet();
136 
137  $set1->addColor($white);
138  $set1->addColor($black);
139  $set1->addColor($grey);
140  $set1->addColor($red);
141  $set1->addColor($green);
142  $set1->addColor($blue);
143 
144  $this->assertEquals($as_array,$set1->asArray());
145  }
$blue
Definition: example_030.php:81
$red
Definition: example_030.php:80
$green
Definition: example_030.php:83
$white
Definition: example_030.php:84
$black
Definition: example_030.php:85

◆ testAsString()

ilSystemStyleIconColorSetTest::testAsString ( )

Definition at line 147 of file ilSystemStyleIconColorSetTest.php.

References $black, $blue, $green, $red, and $white.

147  {
148  $white = new ilSystemStyleIconColor("id1","name","FFFFFF","description");
149  $black = new ilSystemStyleIconColor("id2","name","000000","description");
150  $grey = new ilSystemStyleIconColor("id3","name","AAAAAA","description");
151 
152  $red = new ilSystemStyleIconColor("id4","name","FF0000","description");
153  $green = new ilSystemStyleIconColor("id5","name","00FF00","description");
154  $blue = new ilSystemStyleIconColor("id6","name","0000FF","description");
155 
156  $as_string = "id1; id2; id3; id4; id5; id6; ";
157 
158  $set1 = new ilSystemStyleIconColorSet();
159 
160  $set1->addColor($white);
161  $set1->addColor($black);
162  $set1->addColor($grey);
163  $set1->addColor($red);
164  $set1->addColor($green);
165  $set1->addColor($blue);
166 
167  $this->assertEquals($as_string,$set1->asString());
168  }
$blue
Definition: example_030.php:81
$red
Definition: example_030.php:80
$green
Definition: example_030.php:83
$white
Definition: example_030.php:84
$black
Definition: example_030.php:85

◆ testConstruct()

ilSystemStyleIconColorSetTest::testConstruct ( )

Definition at line 16 of file ilSystemStyleIconColorSetTest.php.

16  {
17  $set = new ilSystemStyleIconColorSet();
18 
19  $this->assertEquals([],$set->getColors());
20  }

◆ testDoesColorExist()

ilSystemStyleIconColorSetTest::testDoesColorExist ( )

Definition at line 60 of file ilSystemStyleIconColorSetTest.php.

60  {
61  $color1 = new ilSystemStyleIconColor("id1","name","FF0000","description");
62  $set = new ilSystemStyleIconColorSet();
63  $set->addColor($color1);
64 
65  $this->assertTrue($set->doesColorExist("id1"));
66  $this->assertFalse($set->doesColorExist("otherId"));
67  $this->assertFalse($set->doesColorExist(""));
68  }

◆ testGetColorsSortedAsArray()

ilSystemStyleIconColorSetTest::testGetColorsSortedAsArray ( )

Definition at line 96 of file ilSystemStyleIconColorSetTest.php.

References $black, $blue, $green, $red, $white, ilSystemStyleIconColor\BLUE, ilSystemStyleIconColor\GREEN, ilSystemStyleIconColor\GREY, and ilSystemStyleIconColor\RED.

96  {
97  $white = new ilSystemStyleIconColor("id1","name","FFFFFF","description");
98  $black = new ilSystemStyleIconColor("id2","name","000000","description");
99  $grey = new ilSystemStyleIconColor("id3","name","AAAAAA","description");
100 
101  $red = new ilSystemStyleIconColor("id4","name","FF0000","description");
102  $green = new ilSystemStyleIconColor("id5","name","00FF00","description");
103  $blue = new ilSystemStyleIconColor("id6","name","0000FF","description");
104 
105  $ordered_array = [
110  ];
111 
112  $set1 = new ilSystemStyleIconColorSet();
113 
114  $set1->addColor($white);
115  $set1->addColor($black);
116  $set1->addColor($grey);
117  $set1->addColor($red);
118  $set1->addColor($green);
119  $set1->addColor($blue);
120 
121  $this->assertEquals($ordered_array,$set1->getColorsSortedAsArray());
122  }
$blue
Definition: example_030.php:81
$red
Definition: example_030.php:80
$green
Definition: example_030.php:83
$white
Definition: example_030.php:84
$black
Definition: example_030.php:85

◆ testGetInvalidId()

ilSystemStyleIconColorSetTest::testGetInvalidId ( )

Definition at line 46 of file ilSystemStyleIconColorSetTest.php.

References ilSystemStyleException\INVALID_ID.

46  {
47  $color1 = new ilSystemStyleIconColor("id1","name","FF0000","description");
48  $set = new ilSystemStyleIconColorSet();
49  $set->addColor($color1);
50 
51  try{
52  $set->getColorById("idXY");
53  $this->assertTrue(false);
54  }catch(ilSystemStyleException $e){
55  $this->assertEquals(ilSystemStyleException::INVALID_ID,$e->getCode());
56  }
57 
58  }
Class for advanced editing exception handling in ILIAS.

◆ testMergeColorSet()

ilSystemStyleIconColorSetTest::testMergeColorSet ( )

Definition at line 70 of file ilSystemStyleIconColorSetTest.php.

70  {
71  $color1 = new ilSystemStyleIconColor("id1","name","FF0000","description");
72  $color2 = new ilSystemStyleIconColor("id2","name","FF0000","description");
73  $color3 = new ilSystemStyleIconColor("id3","name","FF0000","description");
74 
75  $set1 = new ilSystemStyleIconColorSet();
76  $set2 = new ilSystemStyleIconColorSet();
77 
78  $set1->addColor($color1);
79  $set1->addColor($color2);
80 
81  $set2->addColor($color2);
82  $set2->addColor($color3);
83 
84  $set1->mergeColorSet($set2);
85 
86  $this->assertEquals(3,count($set1->getColors()));
87  $this->assertEquals($color1,$set1->getColorById("id1"));
88  $this->assertEquals($color2,$set1->getColorById("id2"));
89  $this->assertEquals($color3,$set1->getColorById("id3"));
90 
91  $this->assertEquals(2,count($set2->getColors()));
92  $this->assertEquals($color2,$set2->getColorById("id2"));
93  $this->assertEquals($color3,$set2->getColorById("id3"));
94  }

The documentation for this class was generated from the following file: