ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSystemStyleIconFolderTest Class Reference
+ Inheritance diagram for ilSystemStyleIconFolderTest:
+ Collaboration diagram for ilSystemStyleIconFolderTest:

Public Member Functions

 testConstruct ()
 
 testSetPath ()
 
 testReadRecursiveCount ()
 
 testFolderDoesNotExist ()
 
 testFolderGetIconByName ()
 
 testFolderGetIconByPath ()
 
 testIconDoesNotExist ()
 
 testReadRecursiveAndSortByName ()
 
 testReadRecursiveAndSortByFolder ()
 
 testExtractColorset ()
 
 testExtractChangeColors ()
 
 testGetUsages ()
 
 testGetUsagesAfterChangeColor ()
 
 testGetUsagesAsString ()
 

Protected Attributes

string $icon_name = 'test_image_1.svg'
 
string $icon_type = 'svg'
 
- Protected Attributes inherited from ilSystemStyleBaseFSTest
ilSystemStyleConfigMock $system_style_config
 
ilSkinStyleContainer $container
 
ilSkinStyle $style
 
ilFileSystemHelper $file_system
 
ILIAS DI Container $save_dic = null
 
ilLanguage $lng
 
ilSystemStyleMessageStack $message_stack
 

Additional Inherited Members

- Protected Member Functions inherited from ilSystemStyleBaseFSTest
 setUp ()
 
 tearDown ()
 

Detailed Description

Definition at line 23 of file ilSystemStyleIconFolderTest.php.

Member Function Documentation

◆ testConstruct()

ilSystemStyleIconFolderTest::testConstruct ( )

Definition at line 28 of file ilSystemStyleIconFolderTest.php.

28  : void
29  {
30  $folder = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
31 
32  $this->assertEquals($this->container->getImagesSkinPath($this->style->getId()), $folder->getPath());
33  }
Abstracts a folder containing a set of icons.

◆ testExtractChangeColors()

ilSystemStyleIconFolderTest::testExtractChangeColors ( )

Definition at line 168 of file ilSystemStyleIconFolderTest.php.

168  : void
169  {
170  $folder1 = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
171  $folder1->changeIconColors(['505050' => '555555']);
172 
173  $folder2 = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
174 
175  $expected_color_set = new ilSystemStyleIconColorSet();
176  $color1 = new ilSystemStyleIconColor('id_555555', '555555', '555555', '555555');
177  $color2 = new ilSystemStyleIconColor('id_6B6B6B', '6B6B6B', '6B6B6B', '6B6B6B');
178  $color3 = new ilSystemStyleIconColor('id_838383', '838383', '838383', '838383');
179  $color4 = new ilSystemStyleIconColor('id_8C8C8C', '8C8C8C', '8C8C8C', '8C8C8C');
180  $color5 = new ilSystemStyleIconColor('id_303030', '303030', '303030', '303030');
181  $color6 = new ilSystemStyleIconColor('id_404040', '404040', '404040', '404040');
182  $color7 = new ilSystemStyleIconColor('id_000', '000', '000', '000');
183 
184  $expected_color_set->addColor($color2);
185  $expected_color_set->addColor($color3);
186  $expected_color_set->addColor($color4);
187  $expected_color_set->addColor($color5);
188  $expected_color_set->addColor($color6);
189  $expected_color_set->addColor($color1);
190  $expected_color_set->addColor($color7);
191 
192  $this->assertEquals($expected_color_set, $folder2->getColorSet());
193  }
Abstracts a folder containing a set of icons.

◆ testExtractColorset()

ilSystemStyleIconFolderTest::testExtractColorset ( )

Definition at line 144 of file ilSystemStyleIconFolderTest.php.

144  : void
145  {
146  $folder = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
147 
148  $expected_color_set = new ilSystemStyleIconColorSet();
149  $color1 = new ilSystemStyleIconColor('id_505050', '505050', '505050', '505050');
150  $color2 = new ilSystemStyleIconColor('id_6B6B6B', '6B6B6B', '6B6B6B', '6B6B6B');
151  $color3 = new ilSystemStyleIconColor('id_838383', '838383', '838383', '838383');
152  $color4 = new ilSystemStyleIconColor('id_8C8C8C', '8C8C8C', '8C8C8C', '8C8C8C');
153  $color5 = new ilSystemStyleIconColor('id_303030', '303030', '303030', '303030');
154  $color6 = new ilSystemStyleIconColor('id_404040', '404040', '404040', '404040');
155  $color7 = new ilSystemStyleIconColor('id_000', '000', '000', '000');
156 
157  $expected_color_set->addColor($color1);
158  $expected_color_set->addColor($color2);
159  $expected_color_set->addColor($color3);
160  $expected_color_set->addColor($color4);
161  $expected_color_set->addColor($color5);
162  $expected_color_set->addColor($color6);
163  $expected_color_set->addColor($color7);
164 
165  $this->assertEquals($expected_color_set, $folder->getColorSet());
166  }
Abstracts a folder containing a set of icons.

◆ testFolderDoesNotExist()

ilSystemStyleIconFolderTest::testFolderDoesNotExist ( )

Definition at line 49 of file ilSystemStyleIconFolderTest.php.

References Vendor\Package\$e, and ilSystemStyleIconException\IMAGES_FOLDER_DOES_NOT_EXIST.

49  : void
50  {
51  try {
52  new ilSystemStyleIconFolder('Does not exist');
53  $this->fail();
54  } catch (ilSystemStyleIconException $e) {
55  $this->assertEquals(ilSystemStyleIconException::IMAGES_FOLDER_DOES_NOT_EXIST, $e->getCode());
56  }
57  }
Class for advanced editing exception handling in ILIAS.
Abstracts a folder containing a set of icons.

◆ testFolderGetIconByName()

ilSystemStyleIconFolderTest::testFolderGetIconByName ( )

Definition at line 59 of file ilSystemStyleIconFolderTest.php.

59  : void
60  {
61  $style_path = $this->container->getImagesSkinPath($this->style->getId());
62 
63  $path1 = $style_path . '/test_image_1.svg';
64  $icon1 = new ilSystemStyleIcon('test_image_1.svg', $path1, 'svg');
65  $folder = new ilSystemStyleIconFolder($style_path);
66  $this->assertEquals($icon1, $folder->getIconByName('test_image_1.svg'));
67  }
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...
Abstracts a folder containing a set of icons.

◆ testFolderGetIconByPath()

ilSystemStyleIconFolderTest::testFolderGetIconByPath ( )

Definition at line 69 of file ilSystemStyleIconFolderTest.php.

69  : void
70  {
71  $style_path = $this->container->getImagesSkinPath($this->style->getId());
72 
73  $path1 = $style_path . '/test_image_1.svg';
74  $icon1 = new ilSystemStyleIcon('test_image_1.svg', $path1, 'svg');
75  $folder = new ilSystemStyleIconFolder($style_path);
76  $this->assertEquals($icon1, $folder->getIconByPath($path1));
77  }
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...
Abstracts a folder containing a set of icons.

◆ testGetUsages()

ilSystemStyleIconFolderTest::testGetUsages ( )

Definition at line 195 of file ilSystemStyleIconFolderTest.php.

195  : void
196  {
197  $style_path = $this->container->getImagesSkinPath($this->style->getId());
198 
199  $folder1 = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
200 
201  $path1 = $style_path . '/test_image_1.svg';
202  $icon1 = new ilSystemStyleIcon('test_image_1.svg', $path1, 'svg');
203  $icon1->getColorSet();
204 
205  $path2 = $style_path . '/image_subfolder/sub_test_image_1.svg';
206  $icon2 = new ilSystemStyleIcon('sub_test_image_1.svg', $path2, 'svg');
207  $icon2->getColorSet();
208 
209  $path3 = $style_path . '/image_subfolder/sub_test_image_2.svg';
210  $icon3 = new ilSystemStyleIcon('sub_test_image_2.svg', $path3, 'svg');
211  $icon3->getColorSet();
212 
213  $expected_icons_usages = [$icon2, $icon3, $icon1];
214 
215  $this->assertEquals($expected_icons_usages, $folder1->getUsagesOfColor('id_6B6B6B'));
216  }
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...
Abstracts a folder containing a set of icons.

◆ testGetUsagesAfterChangeColor()

ilSystemStyleIconFolderTest::testGetUsagesAfterChangeColor ( )

Definition at line 218 of file ilSystemStyleIconFolderTest.php.

218  : void
219  {
220  $style_path = $this->container->getImagesSkinPath($this->style->getId());
221 
222  $folder1 = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
223  $folder1->changeIconColors(['6B6B6B' => '7B6B6B']);
224 
225  $folder2 = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
226 
227  $path1 = $style_path . '/test_image_1.svg';
228  $icon1 = new ilSystemStyleIcon('test_image_1.svg', $path1, 'svg');
229  $icon1->getColorSet();
230 
231  $path2 = $style_path . '/image_subfolder/sub_test_image_1.svg';
232  $icon2 = new ilSystemStyleIcon('sub_test_image_1.svg', $path2, 'svg');
233  $icon2->getColorSet();
234 
235  $path3 = $style_path . '/image_subfolder/sub_test_image_2.svg';
236  $icon3 = new ilSystemStyleIcon('sub_test_image_2.svg', $path3, 'svg');
237  $icon3->getColorSet();
238 
239  $expected_icons_usages = [$icon2, $icon3, $icon1];
240 
241  $this->assertEquals($expected_icons_usages, $folder2->getUsagesOfColor('id_7B6B6B'));
242  $this->assertEquals([], $folder2->getUsagesOfColor('id_6B6B6B'));
243  }
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...
Abstracts a folder containing a set of icons.

◆ testGetUsagesAsString()

ilSystemStyleIconFolderTest::testGetUsagesAsString ( )

Definition at line 245 of file ilSystemStyleIconFolderTest.php.

245  : void
246  {
247  $folder1 = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
248 
249  $this->assertEquals(
250  'sub_test_image_1; sub_test_image_2; test_image_1; ',
251  $folder1->getUsagesOfColorAsString('id_6B6B6B')
252  );
253  }
Abstracts a folder containing a set of icons.

◆ testIconDoesNotExist()

ilSystemStyleIconFolderTest::testIconDoesNotExist ( )

Definition at line 79 of file ilSystemStyleIconFolderTest.php.

References Vendor\Package\$e, and ilSystemStyleIconException\ICON_DOES_NOT_EXIST.

79  : void
80  {
81  $folder = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
82 
83  try {
84  $folder->getIconByName('doesNotExist.svg');
85  $this->fail();
86  } catch (ilSystemStyleIconException $e) {
87  $this->assertEquals(ilSystemStyleIconException::ICON_DOES_NOT_EXIST, $e->getCode());
88  }
89  }
Class for advanced editing exception handling in ILIAS.
Abstracts a folder containing a set of icons.

◆ testReadRecursiveAndSortByFolder()

ilSystemStyleIconFolderTest::testReadRecursiveAndSortByFolder ( )

Definition at line 116 of file ilSystemStyleIconFolderTest.php.

116  : void
117  {
118  $style_path = $this->container->getImagesSkinPath($this->style->getId());
119 
120  $path1 = $style_path . '/test_image_1.svg';
121  $icon1 = new ilSystemStyleIcon('test_image_1.svg', $path1, 'svg');
122 
123  $path2 = $style_path . '/image_subfolder/sub_test_image_1.svg';
124  $icon2 = new ilSystemStyleIcon('sub_test_image_1.svg', $path2, 'svg');
125 
126  $path3 = $style_path . '/image_subfolder/sub_test_image_2.svg';
127  $icon3 = new ilSystemStyleIcon('sub_test_image_2.svg', $path3, 'svg');
128 
129  $path4 = $style_path . '/nonsvg.png';
130  $icon4 = new ilSystemStyleIcon('nonsvg.png', $path4, 'png');
131 
132  $path5 = $style_path . '/icon_accs.svg';
133  $icon5 = new ilSystemStyleIcon('icon_accs.svg', $path5, 'svg');
134 
135  $expected_icons = [
136  $style_path => [$icon5, $icon1, $icon4],
137  $style_path . '/image_subfolder' => [$icon2, $icon3],
138  ];
139 
140  $folder = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
141  $this->assertEquals($expected_icons, $folder->getIconsSortedByFolder());
142  }
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...
Abstracts a folder containing a set of icons.

◆ testReadRecursiveAndSortByName()

ilSystemStyleIconFolderTest::testReadRecursiveAndSortByName ( )

Definition at line 91 of file ilSystemStyleIconFolderTest.php.

91  : void
92  {
93  $style_path = $this->container->getImagesSkinPath($this->style->getId());
94 
95  $path1 = $style_path . '/test_image_1.svg';
96  $icon1 = new ilSystemStyleIcon('test_image_1.svg', $path1, 'svg');
97 
98  $path2 = $style_path . '/image_subfolder/sub_test_image_1.svg';
99  $icon2 = new ilSystemStyleIcon('sub_test_image_1.svg', $path2, 'svg');
100 
101  $path3 = $style_path . '/image_subfolder/sub_test_image_2.svg';
102  $icon3 = new ilSystemStyleIcon('sub_test_image_2.svg', $path3, 'svg');
103 
104  $path4 = $style_path . '/nonsvg.png';
105  $icon4 = new ilSystemStyleIcon('nonsvg.png', $path4, 'png');
106 
107  $path5 = $style_path . '/icon_accs.svg';
108  $icon5 = new ilSystemStyleIcon('icon_accs.svg', $path5, 'svg');
109 
110  $expected_icons = [$icon5, $icon2, $icon3, $icon1, $icon4];
111 
112  $folder = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
113  $this->assertEquals($expected_icons, $folder->getIcons());
114  }
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...
Abstracts a folder containing a set of icons.

◆ testReadRecursiveCount()

ilSystemStyleIconFolderTest::testReadRecursiveCount ( )

Definition at line 43 of file ilSystemStyleIconFolderTest.php.

43  : void
44  {
45  $folder = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
46  $this->assertCount(5, $folder->getIcons());
47  }
Abstracts a folder containing a set of icons.

◆ testSetPath()

ilSystemStyleIconFolderTest::testSetPath ( )

Definition at line 35 of file ilSystemStyleIconFolderTest.php.

35  : void
36  {
37  $folder = new ilSystemStyleIconFolder($this->container->getImagesSkinPath($this->style->getId()));
38  $folder->setPath('pathnew');
39 
40  $this->assertEquals('pathnew', $folder->getPath());
41  }
Abstracts a folder containing a set of icons.

Field Documentation

◆ $icon_name

string ilSystemStyleIconFolderTest::$icon_name = 'test_image_1.svg'
protected

Definition at line 25 of file ilSystemStyleIconFolderTest.php.

◆ $icon_type

string ilSystemStyleIconFolderTest::$icon_type = 'svg'
protected

Definition at line 26 of file ilSystemStyleIconFolderTest.php.


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