19 declare(strict_types=1);
21 require_once(
'libs/composer/vendor/autoload.php');
32 $this->assertEquals($this->container->getImagesSkinPath($this->style->getId()), $folder->getPath());
38 $folder->setPath(
'pathnew');
40 $this->assertEquals(
'pathnew', $folder->getPath());
46 $this->assertCount(5, $folder->getIcons());
61 $style_path = $this->container->getImagesSkinPath($this->style->getId());
63 $path1 = $style_path .
'/test_image_1.svg';
66 $this->assertEquals($icon1, $folder->getIconByName(
'test_image_1.svg'));
71 $style_path = $this->container->getImagesSkinPath($this->style->getId());
73 $path1 = $style_path .
'/test_image_1.svg';
76 $this->assertEquals($icon1, $folder->getIconByPath($path1));
84 $folder->getIconByName(
'doesNotExist.svg');
93 $style_path = $this->container->getImagesSkinPath($this->style->getId());
95 $path1 = $style_path .
'/test_image_1.svg';
98 $path2 = $style_path .
'/image_subfolder/sub_test_image_1.svg';
101 $path3 = $style_path .
'/image_subfolder/sub_test_image_2.svg';
104 $path4 = $style_path .
'/nonsvg.png';
107 $path5 = $style_path .
'/icon_accs.svg';
110 $expected_icons = [$icon5, $icon2, $icon3, $icon1, $icon4];
113 $this->assertEquals($expected_icons, $folder->getIcons());
118 $style_path = $this->container->getImagesSkinPath($this->style->getId());
120 $path1 = $style_path .
'/test_image_1.svg';
123 $path2 = $style_path .
'/image_subfolder/sub_test_image_1.svg';
126 $path3 = $style_path .
'/image_subfolder/sub_test_image_2.svg';
129 $path4 = $style_path .
'/nonsvg.png';
132 $path5 = $style_path .
'/icon_accs.svg';
136 $style_path => [$icon5, $icon1, $icon4],
137 $style_path .
'/image_subfolder' => [$icon2, $icon3],
141 $this->assertEquals($expected_icons, $folder->getIconsSortedByFolder());
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);
165 $this->assertEquals($expected_color_set, $folder->getColorSet());
171 $folder1->changeIconColors([
'505050' =>
'555555']);
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);
192 $this->assertEquals($expected_color_set, $folder2->getColorSet());
197 $style_path = $this->container->getImagesSkinPath($this->style->getId());
201 $path1 = $style_path .
'/test_image_1.svg';
203 $icon1->getColorSet();
205 $path2 = $style_path .
'/image_subfolder/sub_test_image_1.svg';
207 $icon2->getColorSet();
209 $path3 = $style_path .
'/image_subfolder/sub_test_image_2.svg';
211 $icon3->getColorSet();
213 $expected_icons_usages = [$icon2, $icon3, $icon1];
215 $this->assertEquals($expected_icons_usages, $folder1->getUsagesOfColor(
'id_6B6B6B'));
220 $style_path = $this->container->getImagesSkinPath($this->style->getId());
223 $folder1->changeIconColors([
'6B6B6B' =>
'7B6B6B']);
227 $path1 = $style_path .
'/test_image_1.svg';
229 $icon1->getColorSet();
231 $path2 = $style_path .
'/image_subfolder/sub_test_image_1.svg';
233 $icon2->getColorSet();
235 $path3 = $style_path .
'/image_subfolder/sub_test_image_2.svg';
237 $icon3->getColorSet();
239 $expected_icons_usages = [$icon2, $icon3, $icon1];
241 $this->assertEquals($expected_icons_usages, $folder2->getUsagesOfColor(
'id_7B6B6B'));
242 $this->assertEquals([], $folder2->getUsagesOfColor(
'id_6B6B6B'));
250 'sub_test_image_1; sub_test_image_2; test_image_1; ',
251 $folder1->getUsagesOfColorAsString(
'id_6B6B6B')
Class for advanced editing exception handling in ILIAS.
testReadRecursiveAndSortByName()
testFolderGetIconByName()
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...
testFolderGetIconByPath()
const IMAGES_FOLDER_DOES_NOT_EXIST
testReadRecursiveAndSortByFolder()
Abstracts a folder containing a set of icons.
testExtractChangeColors()
const ICON_DOES_NOT_EXIST
testGetUsagesAfterChangeColor()