ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSystemStyleIconTest Class Reference
+ Inheritance diagram for ilSystemStyleIconTest:
+ Collaboration diagram for ilSystemStyleIconTest:

Public Member Functions

 testConstruct ()
 
 testGetDirRelToCustomizing ()
 
 testGetColorSet ()
 
 testChangeColor ()
 
 testChangeColorInIconFile ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Protected Attributes

 $system_style_config
 
 $container
 
 $style
 
 $icon_name = "test_image_1.svg"
 
 $icon_type = "svg"
 
 $save_dic = null
 

Detailed Description

Author
Timon Amstutz timon.nosp@m..ams.nosp@m.tutz@.nosp@m.ilub.nosp@m..unib.nosp@m.e.ch
Version
$Id$*

Definition at line 17 of file ilSystemStyleIconTest.php.

Member Function Documentation

◆ setUp()

ilSystemStyleIconTest::setUp ( )
protected

Definition at line 48 of file ilSystemStyleIconTest.php.

49 {
50 global $DIC;
51
52 $this->save_dic = $DIC;
53
55
56 $this->system_style_config = new ilSystemStyleConfigMock();
57
58 mkdir($this->system_style_config->test_skin_temp_path);
59 ilSystemStyleSkinContainer::xCopy($this->system_style_config->test_skin_original_path, $this->system_style_config->test_skin_temp_path);
60
61 $this->container = ilSystemStyleSkinContainer::generateFromId("skin1", null, $this->system_style_config);
62 $this->style = $this->container->getSkin()->getStyle("style1");
63 }
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Class ilLanguageMock.
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
static xCopy($src, $dest)
Recursive copy of a folder.
global $DIC
Definition: saml.php:7

References $DIC, ilSystemStyleSkinContainer\generateFromId(), and ilSystemStyleSkinContainer\xCopy().

+ Here is the call graph for this function:

◆ tearDown()

ilSystemStyleIconTest::tearDown ( )
protected

Definition at line 65 of file ilSystemStyleIconTest.php.

66 {
67 global $DIC;
69 ilSystemStyleSkinContainer::recursiveRemoveDir($this->system_style_config->test_skin_temp_path);
70 }
static recursiveRemoveDir($dir)
Recursive delete of a folder.

References $DIC, $save_dic, and ilSystemStyleSkinContainer\recursiveRemoveDir().

+ Here is the call graph for this function:

◆ testChangeColor()

ilSystemStyleIconTest::testChangeColor ( )

Definition at line 115 of file ilSystemStyleIconTest.php.

116 {
117 $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
118 $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
119
120 $icon->changeColors(['505050' => '555555']);
121
122 $expected_color_set = new ilSystemStyleIconColorSet();
123 $color1 = new ilSystemStyleIconColor("555555", "555555", "555555", "555555");
124 $color2 = new ilSystemStyleIconColor("6B6B6B", "6B6B6B", "6B6B6B", "6B6B6B");
125 $color3 = new ilSystemStyleIconColor("838383", "838383", "838383", "838383");
126 $color4 = new ilSystemStyleIconColor("8C8C8C", "8C8C8C", "8C8C8C", "8C8C8C");
127 $expected_color_set->addColor($color1);
128 $expected_color_set->addColor($color2);
129 $expected_color_set->addColor($color3);
130 $expected_color_set->addColor($color4);
131
132 $this->assertEquals($expected_color_set, $icon->getColorSet());
133 }
$path
Definition: aliased.php:25
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon.

References $icon_name, and $path.

◆ testChangeColorInIconFile()

ilSystemStyleIconTest::testChangeColorInIconFile ( )

Definition at line 135 of file ilSystemStyleIconTest.php.

136 {
137 $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
138 $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
139
140 $icon->changeColors(['505050' => '555555']);
141
142 $expected_color_set = new ilSystemStyleIconColorSet();
143 $color1 = new ilSystemStyleIconColor("555555", "555555", "555555", "555555");
144 $color2 = new ilSystemStyleIconColor("6B6B6B", "6B6B6B", "6B6B6B", "6B6B6B");
145 $color3 = new ilSystemStyleIconColor("838383", "838383", "838383", "838383");
146 $color4 = new ilSystemStyleIconColor("8C8C8C", "8C8C8C", "8C8C8C", "8C8C8C");
147 $expected_color_set->addColor($color1);
148 $expected_color_set->addColor($color2);
149 $expected_color_set->addColor($color3);
150 $expected_color_set->addColor($color4);
151
152 $icon_new = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
153
154 $this->assertEquals($expected_color_set, $icon_new->getColorSet());
155 }

References $icon_name, and $path.

◆ testConstruct()

ilSystemStyleIconTest::testConstruct ( )

Definition at line 72 of file ilSystemStyleIconTest.php.

73 {
74 $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
75 $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
76
77 $this->assertEquals($icon->getName(), $this->icon_name);
78 $this->assertEquals($icon->getPath(), $path);
79 $this->assertEquals($icon->getType(), $this->icon_type);
80 }

References $icon_name, and $path.

◆ testGetColorSet()

ilSystemStyleIconTest::testGetColorSet ( )

Definition at line 97 of file ilSystemStyleIconTest.php.

98 {
99 $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
100 $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
101
102 $expected_color_set = new ilSystemStyleIconColorSet();
103 $color1 = new ilSystemStyleIconColor("505050", "505050", "505050", "505050");
104 $color2 = new ilSystemStyleIconColor("6B6B6B", "6B6B6B", "6B6B6B", "6B6B6B");
105 $color3 = new ilSystemStyleIconColor("838383", "838383", "838383", "838383");
106 $color4 = new ilSystemStyleIconColor("8C8C8C", "8C8C8C", "8C8C8C", "8C8C8C");
107 $expected_color_set->addColor($color1);
108 $expected_color_set->addColor($color2);
109 $expected_color_set->addColor($color3);
110 $expected_color_set->addColor($color4);
111
112 $this->assertEquals($expected_color_set, $icon->getColorSet());
113 }

References $icon_name, and $path.

◆ testGetDirRelToCustomizing()

ilSystemStyleIconTest::testGetDirRelToCustomizing ( )

Definition at line 82 of file ilSystemStyleIconTest.php.

83 {
84 $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
85 $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
86
87 $this->assertEquals($icon->getDirRelToCustomizing(), "");
88
89 $name = "test.svg";
90 $rel_path = "global/skin/unibe50/images";
91 $path = "./Customizing" . $rel_path . "/" . $name;
92 $icon = new ilSystemStyleIcon($name, $path, "svg");
93
94 $this->assertEquals($icon->getDirRelToCustomizing(), $rel_path);
95 }

References $icon_name, $name, and $path.

Field Documentation

◆ $container

ilSystemStyleIconTest::$container
protected

Definition at line 28 of file ilSystemStyleIconTest.php.

◆ $icon_name

ilSystemStyleIconTest::$icon_name = "test_image_1.svg"
protected

◆ $icon_type

ilSystemStyleIconTest::$icon_type = "svg"
protected

Definition at line 43 of file ilSystemStyleIconTest.php.

◆ $save_dic

ilSystemStyleIconTest::$save_dic = null
protected

Definition at line 46 of file ilSystemStyleIconTest.php.

Referenced by tearDown().

◆ $style

ilSystemStyleIconTest::$style
protected

Definition at line 33 of file ilSystemStyleIconTest.php.

◆ $system_style_config

ilSystemStyleIconTest::$system_style_config
protected

Definition at line 23 of file ilSystemStyleIconTest.php.


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