ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSkinStyleContainerTest Class Reference
+ Inheritance diagram for ilSkinStyleContainerTest:
+ Collaboration diagram for ilSkinStyleContainerTest:

Public Member Functions

 testCreateDelete ()
 
 testUpdateSkinNoIdChange ()
 
 testUpdateSkinWithChangedID ()
 
 testAddStyle ()
 
 testDeleteStyle ()
 
 testUpdateStyle ()
 
 testDeleteSkin ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from ilSystemStyleBaseFSTest
 setUp ()
 
 tearDown ()
 

Protected Attributes

ilSkin $skin
 
ilSkinStyle $style1
 
ilSkinStyle $style2
 
ilSkinFactory $factory
 
- Protected Attributes inherited from ilSystemStyleBaseFSTest
ilSystemStyleConfigMock $system_style_config
 
ilSkinStyleContainer $container
 
ilSkinStyle $style
 
ilFileSystemHelper $file_system
 
ILIAS DI Container $save_dic = null
 
ilLanguage $lng
 
ilSystemStyleMessageStack $message_stack
 

Detailed Description

Definition at line 23 of file ilSkinStyleContainerTest.php.

Member Function Documentation

◆ setUp()

ilSkinStyleContainerTest::setUp ( )
protected

Definition at line 30 of file ilSkinStyleContainerTest.php.

References $ini, and ILIAS\Repository\lng().

30  : void
31  {
32  parent::setUp();
33 
34  if (!defined('PATH_TO_LESSC')) {
35  if (file_exists('ilias.ini.php')) {
36  $ini = parse_ini_file('ilias.ini.php', true);
37  define('PATH_TO_LESSC', $ini['tools']['lessc'] ?? '');
38  } else {
39  define('PATH_TO_LESSC', '');
40  }
41  }
42 
43  $this->skin = new ilSkin('skin1', 'skin 1');
44 
45  $this->style1 = new ilSkinStyle('style1', 'Style 1');
46  $this->style1->setCssFile('style1css');
47  $this->style1->setImageDirectory('style1image');
48  $this->style1->setSoundDirectory('style1sound');
49  $this->style1->setFontDirectory('style1font');
50 
51  $this->style2 = new ilSkinStyle('style2', 'Style 2');
52  $this->style2->setCssFile('style2css');
53  $this->style2->setImageDirectory('style2image');
54  $this->style2->setSoundDirectory('style2sound');
55  $this->style2->setFontDirectory('style2font');
56 
57  $this->factory = new ilSkinFactory($this->lng, $this->system_style_config);
58  }
Factory to create Skin classes holds an manages the basic data of a skin as provide by the template o...
$ini
Definition: raiseError.php:4
ilSkin holds an manages the basic data of a skin as provide by the template of the skin...
+ Here is the call graph for this function:

◆ testAddStyle()

ilSkinStyleContainerTest::testAddStyle ( )

Definition at line 92 of file ilSkinStyleContainerTest.php.

References ilSystemStyleBaseFSTest\$container, ilSystemStyleBaseFSTest\$message_stack, and ilSkinStyleContainer\addStyle().

92  : void
93  {
94  $new_style = new ilSkinStyle('style1new', 'new Style');
95  $new_style->setCssFile('style1new');
96  $new_style->setImageDirectory('style1newimage');
97  $new_style->setSoundDirectory('style1newsound');
98  $new_style->setFontDirectory('style1newfont');
99 
100  $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
101 
102  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1image'));
103  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1sound'));
104  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1font'));
105  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1css.css'));
106  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1css.less'));
107  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1css-variables.less'));
108 
109  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1newimage'));
110  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1newsound'));
111  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1newfont'));
112  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1new.css'));
113  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1new.less'));
114  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1new-variables.less'));
115 
116  $container->addStyle($new_style);
117 
118  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1image'));
119  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1sound'));
120  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1font'));
121  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1css.css'));
122  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1css.less'));
123  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1css-variables.less'));
124 
125  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1newimage'));
126  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1newsound'));
127  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1newfont'));
128  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1new.css'));
129  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1new.less'));
130  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1new-variables.less'));
131  }
ilSystemStyleMessageStack $message_stack
ilSkinStyleContainer $container
+ Here is the call graph for this function:

◆ testCreateDelete()

ilSkinStyleContainerTest::testCreateDelete ( )

Definition at line 60 of file ilSkinStyleContainerTest.php.

References ilSystemStyleBaseFSTest\$container, ilSystemStyleBaseFSTest\$message_stack, ilSkinStyleContainer\create(), ilSkinStyleContainer\delete(), and ilSkinStyleContainer\getSkin().

60  : void
61  {
62  $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
63 
64  $container->getSkin()->setId('newSkin');
65  $container->create($this->message_stack);
66 
67  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . 'newSkin'));
68  $container->delete();
69  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . 'newSkin'));
70  }
delete()
Deletes the container of a skin completely.
ilSystemStyleMessageStack $message_stack
ilSkinStyleContainer $container
create(ilSystemStyleMessageStack $message_stack)
Creates a new skin.
+ Here is the call graph for this function:

◆ testDeleteSkin()

ilSkinStyleContainerTest::testDeleteSkin ( )

Definition at line 186 of file ilSkinStyleContainerTest.php.

References ilSystemStyleBaseFSTest\$container, ilSystemStyleBaseFSTest\$message_stack, ilSkinStyleContainer\delete(), ilSkin\getId(), and ilSkinStyleContainer\getSkin().

186  : void
187  {
188  $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
189  $skin = $container->getSkin();
190 
191  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId()));
192  $container->delete();
193  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId()));
194  }
delete()
Deletes the container of a skin completely.
ilSystemStyleMessageStack $message_stack
ilSkinStyleContainer $container
+ Here is the call graph for this function:

◆ testDeleteStyle()

ilSkinStyleContainerTest::testDeleteStyle ( )

Definition at line 133 of file ilSkinStyleContainerTest.php.

References ilSystemStyleBaseFSTest\$container, ilSystemStyleBaseFSTest\$message_stack, and ilSkinStyleContainer\deleteStyle().

133  : void
134  {
135  $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
136 
137  $container->deleteStyle($this->style1);
138 
139  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1image'));
140  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1sound'));
141  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1font'));
142  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1css.css'));
143  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1css.less'));
144  $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1css-variables.less'));
145 
146  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style2image'));
147  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style2sound'));
148  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style2font'));
149  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style2css.css'));
150  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style2css.less'));
151  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style2css-variables.less'));
152  }
ilSystemStyleMessageStack $message_stack
deleteStyle(ilSkinStyle $style)
Deletes a style completely.
ilSkinStyleContainer $container
+ Here is the call graph for this function:

◆ testUpdateSkinNoIdChange()

ilSkinStyleContainerTest::testUpdateSkinNoIdChange ( )

Definition at line 72 of file ilSkinStyleContainerTest.php.

References ilSystemStyleBaseFSTest\$container, ilSystemStyleBaseFSTest\$message_stack, and ilSkinStyleContainer\updateSkin().

72  : void
73  {
74  $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
76  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId()));
77  }
ilSystemStyleMessageStack $message_stack
ilSkinStyleContainer $container
updateSkin(ilSkin $old_skin=null)
Updates the skin.
+ Here is the call graph for this function:

◆ testUpdateSkinWithChangedID()

ilSkinStyleContainerTest::testUpdateSkinWithChangedID ( )

Definition at line 79 of file ilSkinStyleContainerTest.php.

References ilSystemStyleBaseFSTest\$container, ilSystemStyleBaseFSTest\$message_stack, ilSkinStyleContainer\getSkin(), and ilSkinStyleContainer\updateSkin().

79  : void
80  {
81  $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
82  $old_skin = clone $container->getSkin();
83  $container->getSkin()->setId('newSkin2');
84  $container->updateSkin($old_skin);
85  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . 'newSkin2'));
86  $old_skin = clone $container->getSkin();
87  $container->getSkin()->setId($this->skin->getId());
88  $container->updateSkin($old_skin);
89  $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . 'newSkin2'));
90  }
ilSystemStyleMessageStack $message_stack
ilSkinStyleContainer $container
updateSkin(ilSkin $old_skin=null)
Updates the skin.
+ Here is the call graph for this function:

◆ testUpdateStyle()

ilSkinStyleContainerTest::testUpdateStyle ( )

Definition at line 154 of file ilSkinStyleContainerTest.php.

References ilSystemStyleBaseFSTest\$container, ilSystemStyleBaseFSTest\$message_stack, ilSkinStyleContainer\getSkin(), ilSkin\getStyle(), and ilSkinStyleContainer\updateStyle().

154  : void
155  {
156  $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
157  $skin = $container->getSkin();
158 
159  $old_style = clone $skin->getStyle($this->style1->getId());
160  $new_style = $skin->getStyle($this->style1->getId());
161 
162  $new_style->setId('style1new');
163  $new_style->setName('new Style');
164  $new_style->setCssFile('style1new');
165  $new_style->setImageDirectory('style1newimage');
166  $new_style->setSoundDirectory('style1newsound');
167  $new_style->setFontDirectory('style1newfont');
168 
169  $container->updateStyle($new_style->getId(), $old_style);
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() . '/style1newimage'));
179  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1newsound'));
180  $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1newfont'));
181  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1new.css'));
182  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1new.less'));
183  $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . '/style1new-variables.less'));
184  }
ilSystemStyleMessageStack $message_stack
getStyle(string $id)
updateStyle(string $style_id, ilSkinStyle $old_style)
Updates one single style.
ilSkinStyleContainer $container
+ Here is the call graph for this function:

Field Documentation

◆ $factory

ilSkinFactory ilSkinStyleContainerTest::$factory
protected

Definition at line 28 of file ilSkinStyleContainerTest.php.

◆ $skin

ilSkin ilSkinStyleContainerTest::$skin
protected

Definition at line 25 of file ilSkinStyleContainerTest.php.

◆ $style1

ilSkinStyle ilSkinStyleContainerTest::$style1
protected

Definition at line 26 of file ilSkinStyleContainerTest.php.

◆ $style2

ilSkinStyle ilSkinStyleContainerTest::$style2
protected

Definition at line 27 of file ilSkinStyleContainerTest.php.


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