ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 
 testUpdateSkinNoIdChange ()
 
 testUpdateSkinWithChangedID ()
 
 testAddStyle ()
 
 testDeleteStyle ()
 
 testUpdateStyle ()
 
 testDeleteSkin ()
 
 testCopySkin ()
 
 testCopySkinWithInjectedName ()
 
 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 61 of file ilSystemStyleSkinContainerTest.php.

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

61  : void
62  {
63  global $DIC;
64 
65  $this->save_dic = $DIC;
66  $DIC = new ilSystemStyleDICMock();
67 
68  if (!defined('PATH_TO_LESSC')) {
69  if (file_exists("ilias.ini.php")) {
70  $ini = parse_ini_file("ilias.ini.php", true);
71  define('PATH_TO_LESSC', $ini['tools']['lessc'] ?? '');
72  } else {
73  define('PATH_TO_LESSC', "");
74  }
75  }
76 
77  $this->skin = new ilSkinXML("skin1", "skin 1");
78 
79  $this->style1 = new ilSkinStyleXML("style1", "Style 1");
80  $this->style1->setCssFile("style1css");
81  $this->style1->setImageDirectory("style1image");
82  $this->style1->setSoundDirectory("style1sound");
83  $this->style1->setFontDirectory("style1font");
84 
85  $this->style2 = new ilSkinStyleXML("style2", "Style 2");
86  $this->style2->setCssFile("style2css");
87  $this->style2->setImageDirectory("style2image");
88  $this->style2->setSoundDirectory("style2sound");
89  $this->style2->setFontDirectory("style2font");
90 
91  $this->system_style_config = new ilSystemStyleConfigMock();
92 
93  mkdir($this->system_style_config->test_skin_temp_path);
94  ilSystemStyleSkinContainer::xCopy($this->system_style_config->test_skin_original_path, $this->system_style_config->test_skin_temp_path);
95  }
Class ilLanguageMock.
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin...
global $DIC
Definition: goto.php:24
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
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 97 of file ilSystemStyleSkinContainerTest.php.

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

97  : void
98  {
99  global $DIC;
100  $DIC = $this->save_dic;
101 
102  ilSystemStyleSkinContainer::recursiveRemoveDir($this->system_style_config->test_skin_temp_path);
103  }
static recursiveRemoveDir($dir)
Recursive delete of a folder.
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ testAddStyle()

ilSystemStyleSkinContainerTest::testAddStyle ( )

Definition at line 147 of file ilSystemStyleSkinContainerTest.php.

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

148  {
149  $new_style = new ilSkinStyleXML("style1new", "new Style");
150  $new_style->setCssFile("style1new");
151  $new_style->setImageDirectory("style1newimage");
152  $new_style->setSoundDirectory("style1newsound");
153  $new_style->setFontDirectory("style1newfont");
154 
156 
157  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
158  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
159  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
160  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
161  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
162  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
163 
164  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newimage"));
165  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newsound"));
166  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newfont"));
167  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.css"));
168  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.less"));
169  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new-variables.less"));
170 
171  $container->addStyle($new_style);
172 
173  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
174  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
175  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
176  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
177  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
178  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
179 
180  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newimage"));
181  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newsound"));
182  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newfont"));
183  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.css"));
184  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.less"));
185  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new-variables.less"));
186  }
$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 251 of file ilSystemStyleSkinContainerTest.php.

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

252  {
254  $skin = $container->getSkin();
255 
256  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
257 
258  $container_copy = $container->copy();
259  $skin_copy = $container_copy->getSkin();
260 
261  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
262  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
263  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1image"));
264  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1sound"));
265  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1font"));
266  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.css"));
267  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.less"));
268  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css-variables.less"));
269 
270  $this->assertEquals($skin->getName() . " Copy", $skin_copy->getName());
271  $this->assertEquals("0.1", $skin_copy->getVersion());
272  }
$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:

◆ testCopySkinWithInjectedName()

ilSystemStyleSkinContainerTest::testCopySkinWithInjectedName ( )

Definition at line 274 of file ilSystemStyleSkinContainerTest.php.

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

275  {
277  $skin = $container->getSkin();
278  $container_copy = $container->copy("inject");
279  $skin_copy = $container_copy->getSkin();
280 
281  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "inject"));
282  $this->assertEquals($skin->getName() . " inject", $skin_copy->getName());
283  $this->assertEquals("0.1", $skin_copy->getVersion());
284  }
$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 115 of file ilSystemStyleSkinContainerTest.php.

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

116  {
118 
119  $container->getSkin()->setId("newSkin");
120  $container->create(new ilSystemStyleMessageStack());
121 
122  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin"));
123  $container->delete();
124  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin"));
125  }
$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 241 of file ilSystemStyleSkinContainerTest.php.

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

242  {
244  $skin = $container->getSkin();
245 
246  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId()));
247  $container->delete();
248  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId()));
249  }
$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 188 of file ilSystemStyleSkinContainerTest.php.

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

189  {
191 
192  $container->deleteStyle($this->style1);
193 
194  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
195  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
196  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
197  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
198  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
199  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
200 
201  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2image"));
202  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2sound"));
203  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2font"));
204  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2css.css"));
205  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2css.less"));
206  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2css-variables.less"));
207  }
$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 105 of file ilSystemStyleSkinContainerTest.php.

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

106  {
108  $this->assertEquals($container->getSkin()->getId(), $this->skin->getId());
109  $this->assertEquals($container->getSkin()->getName(), $this->skin->getName());
110 
111  $this->assertEquals($container->getSkin()->getStyle($this->style1->getId()), $this->style1);
112  $this->assertEquals($container->getSkin()->getStyle($this->style2->getId()), $this->style2);
113  }
$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 286 of file ilSystemStyleSkinContainerTest.php.

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

287  {
288  $this->markTestSkipped('Unzipping is not possible due to missing dependencies');
289  return;
290  if (!defined('PATH_TO_ZIP')) {
291  if (file_exists("ilias.ini.php")) {
292  $ini = parse_ini_file("ilias.ini.php", true);
293  define('PATH_TO_ZIP', $ini['tools']['zip']);
294  } elseif (is_executable("/usr/bin/zip")) {
295  define('PATH_TO_ZIP', "/usr/bin/zip");
296  } else {
297  define('PATH_TO_ZIP', "");
298  }
299  }
300 
301  if (!defined('PATH_TO_UNZIP')) {
302  if (file_exists("ilias.ini.php")) {
303  $ini = parse_ini_file("ilias.ini.php", true);
304  define('PATH_TO_UNZIP', $ini['tools']['unzip']);
305  } elseif (is_executable("/usr/bin/unzip")) {
306  define('PATH_TO_UNZIP', "/usr/bin/unzip");
307  } else {
308  define('PATH_TO_UNZIP', "");
309  }
310  }
311 
312  //Only perform this test, if an unzip and zip path has been found.
313  if (PATH_TO_UNZIP !== "" && PATH_TO_ZIP !== "") {
315  $skin = $container->getSkin();
316 
317  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
318 
319  $container_import = $container->import($container->createTempZip(), $this->skin->getId() . ".zip", null, $this->system_style_config, false);
320  $skin_copy = $container_import->getSkin();
321 
322  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
323  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
324  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1image"));
325  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1sound"));
326  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1font"));
327  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.css"));
328  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.less"));
329  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css-variables.less"));
330  } else {
331  $this->markTestIncomplete('No unzip has been detected on the system');
332  }
333  }
$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:

◆ testUpdateSkinNoIdChange()

ilSystemStyleSkinContainerTest::testUpdateSkinNoIdChange ( )

Definition at line 127 of file ilSystemStyleSkinContainerTest.php.

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

128  {
130  $container->updateSkin();
131  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId()));
132  }
$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:

◆ testUpdateSkinWithChangedID()

ilSystemStyleSkinContainerTest::testUpdateSkinWithChangedID ( )

Definition at line 134 of file ilSystemStyleSkinContainerTest.php.

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

135  {
137  $old_skin = clone $container->getSkin();
138  $container->getSkin()->setId("newSkin2");
139  $container->updateSkin($old_skin);
140  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin2"));
141  $old_skin = clone $container->getSkin();
142  $container->getSkin()->setId($this->skin->getId());
143  $container->updateSkin($old_skin);
144  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin2"));
145  }
$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 209 of file ilSystemStyleSkinContainerTest.php.

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

210  {
212  $skin = $container->getSkin();
213 
214  $old_style = clone $skin->getStyle($this->style1->getId());
215  $new_style = $skin->getStyle($this->style1->getId());
216 
217  $new_style->setId("style1new");
218  $new_style->setName("new Style");
219  $new_style->setCssFile("style1new");
220  $new_style->setImageDirectory("style1newimage");
221  $new_style->setSoundDirectory("style1newsound");
222  $new_style->setFontDirectory("style1newfont");
223 
224  $container->updateStyle($new_style->getId(), $old_style);
225 
226  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
227  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
228  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
229  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
230  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
231  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
232 
233  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newimage"));
234  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newsound"));
235  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newfont"));
236  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.css"));
237  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.less"));
238  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new-variables.less"));
239  }
$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 59 of file ilSystemStyleSkinContainerTest.php.

Referenced by tearDown().

◆ $skin

ilSystemStyleSkinContainerTest::$skin
protected

◆ $style1

ilSystemStyleSkinContainerTest::$style1 = null
protected

Definition at line 47 of file ilSystemStyleSkinContainerTest.php.

◆ $style2

ilSystemStyleSkinContainerTest::$style2 = null
protected

Definition at line 52 of file ilSystemStyleSkinContainerTest.php.

◆ $system_style_config


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