ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 43 of file ilSystemStyleSkinContainerTest.php.

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

44  {
45  global $DIC;
46 
47  $this->save_dic = $DIC;
48  $DIC = new ilSystemStyleDICMock();
49 
50  if (!defined('PATH_TO_LESSC')) {
51  if (file_exists("ilias.ini.php")) {
52  $ini = parse_ini_file("ilias.ini.php", true);
53  define('PATH_TO_LESSC', $ini['tools']['lessc']);
54  } else {
55  define('PATH_TO_LESSC', "");
56  }
57  }
58 
59  $this->skin = new ilSkinXML("skin1", "skin 1");
60 
61  $this->style1 = new ilSkinStyleXML("style1", "Style 1");
62  $this->style1->setCssFile("style1css");
63  $this->style1->setImageDirectory("style1image");
64  $this->style1->setSoundDirectory("style1sound");
65  $this->style1->setFontDirectory("style1font");
66 
67  $this->style2 = new ilSkinStyleXML("style2", "Style 2");
68  $this->style2->setCssFile("style2css");
69  $this->style2->setImageDirectory("style2image");
70  $this->style2->setSoundDirectory("style2sound");
71  $this->style2->setFontDirectory("style2font");
72 
73  $this->system_style_config = new ilSystemStyleConfigMock();
74 
75  mkdir($this->system_style_config->test_skin_temp_path);
76  ilSystemStyleSkinContainer::xCopy($this->system_style_config->test_skin_original_path, $this->system_style_config->test_skin_temp_path);
77  }
Class ilLanguageMock.
global $DIC
Definition: saml.php:7
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...
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
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 79 of file ilSystemStyleSkinContainerTest.php.

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

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

◆ testAddStyle()

ilSystemStyleSkinContainerTest::testAddStyle ( )

Definition at line 122 of file ilSystemStyleSkinContainerTest.php.

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

123  {
124  $new_style = new ilSkinStyleXML("style1new", "new Style");
125  $new_style->setCssFile("style1new");
126  $new_style->setImageDirectory("style1newimage");
127  $new_style->setSoundDirectory("style1newsound");
128  $new_style->setFontDirectory("style1newfont");
129 
131 
132  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
133  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
134  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
135  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
136  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
137  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
138 
139  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newimage"));
140  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newsound"));
141  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newfont"));
142  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.css"));
143  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.less"));
144  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new-variables.less"));
145 
146  $container->addStyle($new_style);
147 
148  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
149  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
150  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
151  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
152  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
153  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
154 
155  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newimage"));
156  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newsound"));
157  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newfont"));
158  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.css"));
159  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.less"));
160  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new-variables.less"));
161  }
$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 226 of file ilSystemStyleSkinContainerTest.php.

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

227  {
229  $skin = $container->getSkin();
230 
231  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
232 
233  $container_copy = $container->copy();
234  $skin_copy = $container_copy->getSkin();
235 
236  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
237  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
238  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1image"));
239  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1sound"));
240  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1font"));
241  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.css"));
242  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.less"));
243  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css-variables.less"));
244  }
$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 97 of file ilSystemStyleSkinContainerTest.php.

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

98  {
100 
101  $container->getSkin()->setId("newSkin");
102  $container->create(new ilSystemStyleMessageStack());
103 
104  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin"));
105  $container->delete();
106  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin"));
107  }
$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 216 of file ilSystemStyleSkinContainerTest.php.

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

217  {
219  $skin = $container->getSkin();
220 
221  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId()));
222  $container->delete();
223  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId()));
224  }
$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 163 of file ilSystemStyleSkinContainerTest.php.

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

164  {
166 
167  $container->deleteStyle($this->style1);
168 
169  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
170  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
171  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
172  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
173  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
174  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
175 
176  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2image"));
177  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2sound"));
178  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2font"));
179  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2css.css"));
180  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2css.less"));
181  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style2css-variables.less"));
182  }
$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 87 of file ilSystemStyleSkinContainerTest.php.

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

88  {
90  $this->assertEquals($container->getSkin()->getId(), $this->skin->getId());
91  $this->assertEquals($container->getSkin()->getName(), $this->skin->getName());
92 
93  $this->assertEquals($container->getSkin()->getStyle($this->style1->getId()), $this->style1);
94  $this->assertEquals($container->getSkin()->getStyle($this->style2->getId()), $this->style2);
95  }
$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 246 of file ilSystemStyleSkinContainerTest.php.

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

247  {
248  if (!defined('PATH_TO_ZIP')) {
249  if (file_exists("ilias.ini.php")) {
250  $ini = parse_ini_file("ilias.ini.php", true);
251  define('PATH_TO_ZIP', $ini['tools']['zip']);
252  } else {
253  define('PATH_TO_ZIP', "");
254  }
255  }
256 
257  if (!defined('PATH_TO_UNZIP')) {
258  if (file_exists("ilias.ini.php")) {
259  $ini = parse_ini_file("ilias.ini.php", true);
260  define('PATH_TO_UNZIP', $ini['tools']['unzip']);
261  } else {
262  define('PATH_TO_UNZIP', "");
263  }
264  }
265 
266  //Only perform this test, if an unzip path has been found.
267  if (PATH_TO_UNZIP != "") {
269  $skin = $container->getSkin();
270 
271  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
272 
273  $container_import = $container->import($container->createTempZip(), $this->skin->getId() . ".zip", null, $this->system_style_config, false);
274  $skin_copy = $container_import->getSkin();
275 
276  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . "Copy"));
277  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
278  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1image"));
279  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1sound"));
280  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1font"));
281  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.css"));
282  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css.less"));
283  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . "/style1css-variables.less"));
284  } else {
285  $this->markTestIncomplete('No unzip has been detected on the system');
286  }
287  }
$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.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
$ini
Definition: raiseError.php:4
+ Here is the call graph for this function:

◆ testUpdateSkin()

ilSystemStyleSkinContainerTest::testUpdateSkin ( )

Definition at line 109 of file ilSystemStyleSkinContainerTest.php.

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

110  {
112  $old_skin = clone $container->getSkin();
113  $container->getSkin()->setId("newSkin2");
114  $container->updateSkin($old_skin);
115  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin2"));
116  $old_skin = clone $container->getSkin();
117  $container->getSkin()->setId($this->skin->getId());
118  $container->updateSkin($old_skin);
119  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . "newSkin2"));
120  }
$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 184 of file ilSystemStyleSkinContainerTest.php.

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

185  {
187  $skin = $container->getSkin();
188 
189  $old_style = clone $skin->getStyle($this->style1->getId());
190  $new_style = $skin->getStyle($this->style1->getId());
191 
192  $new_style->setId("style1new");
193  $new_style->setName("new Style");
194  $new_style->setCssFile("style1new");
195  $new_style->setImageDirectory("style1newimage");
196  $new_style->setSoundDirectory("style1newsound");
197  $new_style->setFontDirectory("style1newfont");
198 
199  $container->updateStyle($new_style->getId(), $old_style);
200 
201  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1image"));
202  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1sound"));
203  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1font"));
204  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.css"));
205  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css.less"));
206  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1css-variables.less"));
207 
208  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newimage"));
209  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newsound"));
210  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1newfont"));
211  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.css"));
212  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new.less"));
213  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . "/style1new-variables.less"));
214  }
$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 41 of file ilSystemStyleSkinContainerTest.php.

Referenced by tearDown().

◆ $skin

ilSystemStyleSkinContainerTest::$skin
protected

◆ $style1

ilSystemStyleSkinContainerTest::$style1 = null
protected

Definition at line 29 of file ilSystemStyleSkinContainerTest.php.

◆ $style2

ilSystemStyleSkinContainerTest::$style2 = null
protected

Definition at line 34 of file ilSystemStyleSkinContainerTest.php.

◆ $system_style_config

ilSystemStyleSkinContainerTest::$system_style_config
protected

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