ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSystemStyleSkinContainerTest Class Reference
+ Inheritance diagram for ilSystemStyleSkinContainerTest:
+ Collaboration diagram for ilSystemStyleSkinContainerTest:

Public Member Functions

 testGenerateFromId ()
 
 testCreateDelete ()
 
 testUpdateSkin ()
 
 testAddStyle ()
 
 testDeleteStyle ()
 
 testUpdateStyle ()
 
 testDeleteSkin ()
 
 testCopySkin ()
 
 testImportSkin ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Protected Attributes

 $skin
 
 $style1 = null
 
 $style2 = null
 
 $system_style_config
 
 $save_dic = null
 

Detailed Description

Member Function Documentation

◆ setUp()

ilSystemStyleSkinContainerTest::setUp ( )
protected

Definition at line 45 of file ilSystemStyleSkinContainerTest.php.

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

45  : void
46  {
47  global $DIC;
48 
49  $this->save_dic = $DIC;
50  $DIC = new ilSystemStyleDICMock();
51 
52  if (!defined('PATH_TO_LESSC')) {
53  if (file_exists("ilias.ini.php")) {
54  $ini = parse_ini_file("ilias.ini.php", true);
55  define('PATH_TO_LESSC', $ini['tools']['lessc']);
56  } else {
57  define('PATH_TO_LESSC', "");
58  }
59  }
60 
61  $this->skin = new ilSkinXML("skin1", "skin 1");
62 
63  $this->style1 = new ilSkinStyleXML("style1", "Style 1");
64  $this->style1->setCssFile("style1css");
65  $this->style1->setImageDirectory("style1image");
66  $this->style1->setSoundDirectory("style1sound");
67  $this->style1->setFontDirectory("style1font");
68 
69  $this->style2 = new ilSkinStyleXML("style2", "Style 2");
70  $this->style2->setCssFile("style2css");
71  $this->style2->setImageDirectory("style2image");
72  $this->style2->setSoundDirectory("style2sound");
73  $this->style2->setFontDirectory("style2font");
74 
75  $this->system_style_config = new ilSystemStyleConfigMock();
76 
77  mkdir($this->system_style_config->test_skin_temp_path);
78  ilSystemStyleSkinContainer::xCopy($this->system_style_config->test_skin_original_path, $this->system_style_config->test_skin_temp_path);
79  }
Class ilLanguageMock.
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin...
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
$DIC
Definition: xapitoken.php:46
static xCopy($src, $dest)
Recursive copy of a folder.
$ini
Definition: raiseError.php:4
+ Here is the call graph for this function:

◆ tearDown()

ilSystemStyleSkinContainerTest::tearDown ( )
protected

Definition at line 81 of file ilSystemStyleSkinContainerTest.php.

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

81  : void
82  {
83  global $DIC;
84  $DIC = $this->save_dic;
85 
86  ilSystemStyleSkinContainer::recursiveRemoveDir($this->system_style_config->test_skin_temp_path);
87  }
static recursiveRemoveDir($dir)
Recursive delete of a folder.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ testAddStyle()

ilSystemStyleSkinContainerTest::testAddStyle ( )

Definition at line 124 of file ilSystemStyleSkinContainerTest.php.

References $container, $system_style_config, and ilSystemStyleSkinContainer\generateFromId().

125  {
126  $new_style = new ilSkinStyleXML("style1new", "new Style");
127  $new_style->setCssFile("style1new");
128  $new_style->setImageDirectory("style1newimage");
129  $new_style->setSoundDirectory("style1newsound");
130  $new_style->setFontDirectory("style1newfont");
131 
133 
134  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
135  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
136  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
137  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
138  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
139  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
140 
141  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newimage"));
142  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newsound"));
143  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newfont"));
144  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.css"));
145  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.less"));
146  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new-variables.less"));
147 
148  $container->addStyle($new_style);
149 
150  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
151  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
152  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
153  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
154  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
155  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
156 
157  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newimage"));
158  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newsound"));
159  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newfont"));
160  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.css"));
161  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.less"));
162  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new-variables.less"));
163  }
$container
Definition: wac.php:13
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
+ Here is the call graph for this function:

◆ testCopySkin()

ilSystemStyleSkinContainerTest::testCopySkin ( )

Definition at line 228 of file ilSystemStyleSkinContainerTest.php.

References $container, $skin, $system_style_config, and ilSystemStyleSkinContainer\generateFromId().

229  {
231  $skin = $container->getSkin();
232 
233  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
234 
235  $container_copy = $container->copy();
236  $skin_copy = $container_copy->getSkin();
237 
238  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
239  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
240  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1image"));
241  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1sound"));
242  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1font"));
243  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.css"));
244  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.less"));
245  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css-variables.less"));
246  }
$container
Definition: wac.php:13
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
+ Here is the call graph for this function:

◆ testCreateDelete()

ilSystemStyleSkinContainerTest::testCreateDelete ( )

Definition at line 99 of file ilSystemStyleSkinContainerTest.php.

References $container, $system_style_config, and ilSystemStyleSkinContainer\generateFromId().

100  {
102 
103  $container->getSkin()->setId("newSkin");
104  $container->create(new ilSystemStyleMessageStack());
105 
106  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin"));
107  $container->delete();
108  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin"));
109  }
$container
Definition: wac.php:13
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
Used to stack messages to be shown to the user.
+ Here is the call graph for this function:

◆ testDeleteSkin()

ilSystemStyleSkinContainerTest::testDeleteSkin ( )

Definition at line 218 of file ilSystemStyleSkinContainerTest.php.

References $container, $skin, $system_style_config, and ilSystemStyleSkinContainer\generateFromId().

219  {
221  $skin = $container->getSkin();
222 
223  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId()));
224  $container->delete();
225  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId()));
226  }
$container
Definition: wac.php:13
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
+ Here is the call graph for this function:

◆ testDeleteStyle()

ilSystemStyleSkinContainerTest::testDeleteStyle ( )

Definition at line 165 of file ilSystemStyleSkinContainerTest.php.

References $container, $system_style_config, and ilSystemStyleSkinContainer\generateFromId().

166  {
168 
169  $container->deleteStyle($this->style1);
170 
171  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
172  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
173  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
174  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
175  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
176  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
177 
178  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2image"));
179  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2sound"));
180  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2font"));
181  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2css.css"));
182  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2css.less"));
183  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2css-variables.less"));
184  }
$container
Definition: wac.php:13
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
+ Here is the call graph for this function:

◆ testGenerateFromId()

ilSystemStyleSkinContainerTest::testGenerateFromId ( )

Definition at line 89 of file ilSystemStyleSkinContainerTest.php.

References $container, $system_style_config, and ilSystemStyleSkinContainer\generateFromId().

90  {
92  $this->assertEquals($container->getSkin()->getId(), $this->skin->getId());
93  $this->assertEquals($container->getSkin()->getName(), $this->skin->getName());
94 
95  $this->assertEquals($container->getSkin()->getStyle($this->style1->getId()), $this->style1);
96  $this->assertEquals($container->getSkin()->getStyle($this->style2->getId()), $this->style2);
97  }
$container
Definition: wac.php:13
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
+ Here is the call graph for this function:

◆ testImportSkin()

ilSystemStyleSkinContainerTest::testImportSkin ( )

Definition at line 248 of file ilSystemStyleSkinContainerTest.php.

References $container, $ini, $skin, $system_style_config, and ilSystemStyleSkinContainer\generateFromId().

249  {
250  if (!defined('PATH_TO_ZIP')) {
251  if (file_exists("ilias.ini.php")) {
252  $ini = parse_ini_file("ilias.ini.php", true);
253  define('PATH_TO_ZIP', $ini['tools']['zip']);
254  } elseif (is_executable("/usr/bin/zip")) {
255  define('PATH_TO_ZIP', "/usr/bin/zip");
256  } else {
257  define('PATH_TO_ZIP', "");
258  }
259  }
260 
261  if (!defined('PATH_TO_UNZIP')) {
262  if (file_exists("ilias.ini.php")) {
263  $ini = parse_ini_file("ilias.ini.php", true);
264  define('PATH_TO_UNZIP', $ini['tools']['unzip']);
265  } elseif (is_executable("/usr/bin/unzip")) {
266  define('PATH_TO_UNZIP', "/usr/bin/unzip");
267  } else {
268  define('PATH_TO_UNZIP', "");
269  }
270  }
271 
272  //Only perform this test, if an unzip path has been found.
273  if (PATH_TO_UNZIP != "") {
275  $skin = $container->getSkin();
276 
277  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
278 
279  $container_import = $container->import($container->createTempZip(), $this->skin->getId() . ".zip", null, $this->system_style_config, false);
280  $skin_copy = $container_import->getSkin();
281 
282  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
283  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
284  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1image"));
285  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1sound"));
286  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1font"));
287  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.css"));
288  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.less"));
289  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css-variables.less"));
290  } else {
291  $this->markTestIncomplete('No unzip has been detected on the system');
292  }
293  }
$container
Definition: wac.php:13
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
$ini
Definition: raiseError.php:4
+ Here is the call graph for this function:

◆ testUpdateSkin()

ilSystemStyleSkinContainerTest::testUpdateSkin ( )

Definition at line 111 of file ilSystemStyleSkinContainerTest.php.

References $container, $system_style_config, and ilSystemStyleSkinContainer\generateFromId().

112  {
114  $old_skin = clone $container->getSkin();
115  $container->getSkin()->setId("newSkin2");
116  $container->updateSkin($old_skin);
117  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin2"));
118  $old_skin = clone $container->getSkin();
119  $container->getSkin()->setId($this->skin->getId());
120  $container->updateSkin($old_skin);
121  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin2"));
122  }
$container
Definition: wac.php:13
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
+ Here is the call graph for this function:

◆ testUpdateStyle()

ilSystemStyleSkinContainerTest::testUpdateStyle ( )

Definition at line 186 of file ilSystemStyleSkinContainerTest.php.

References $container, $skin, $system_style_config, and ilSystemStyleSkinContainer\generateFromId().

187  {
189  $skin = $container->getSkin();
190 
191  $old_style = clone $skin->getStyle($this->style1->getId());
192  $new_style = $skin->getStyle($this->style1->getId());
193 
194  $new_style->setId("style1new");
195  $new_style->setName("new Style");
196  $new_style->setCssFile("style1new");
197  $new_style->setImageDirectory("style1newimage");
198  $new_style->setSoundDirectory("style1newsound");
199  $new_style->setFontDirectory("style1newfont");
200 
201  $container->updateStyle($new_style->getId(), $old_style);
202 
203  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
204  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
205  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
206  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
207  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
208  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
209 
210  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newimage"));
211  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newsound"));
212  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newfont"));
213  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.css"));
214  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.less"));
215  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new-variables.less"));
216  }
$container
Definition: wac.php:13
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
+ Here is the call graph for this function:

Field Documentation

◆ $save_dic

ilSystemStyleSkinContainerTest::$save_dic = null
protected

Definition at line 43 of file ilSystemStyleSkinContainerTest.php.

Referenced by tearDown().

◆ $skin

ilSystemStyleSkinContainerTest::$skin
protected

◆ $style1

ilSystemStyleSkinContainerTest::$style1 = null
protected

Definition at line 31 of file ilSystemStyleSkinContainerTest.php.

◆ $style2

ilSystemStyleSkinContainerTest::$style2 = null
protected

Definition at line 36 of file ilSystemStyleSkinContainerTest.php.

◆ $system_style_config

ilSystemStyleSkinContainerTest::$system_style_config
protected

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