ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
ilSkinFactoryTest Class Reference
+ Inheritance diagram for ilSkinFactoryTest:
+ Collaboration diagram for ilSkinFactoryTest:

Public Member Functions

 testSkinFromXML ()
 
 testSkinStyleContainerFromId ()
 
 testCopySkin ()
 
 testCopySkinWithInjectedName ()
 
 testImportSkin ()
 

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 ilSkinFactoryTest.php.

Member Function Documentation

◆ setUp()

ilSkinFactoryTest::setUp ( )
protected

Reimplemented from ilSystemStyleBaseFSTest.

Definition at line 30 of file ilSkinFactoryTest.php.

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
59 global $DIC;
60
62 $DIC['tpl'] = $this->getMockBuilder(ilGlobalTemplateInterface::class)->getMock();
63 }
Factory to create Skin classes holds an manages the basic data of a skin as provide by the template o...
ilSkin holds an manages the basic data of a skin as provide by the template of the skin.
global $DIC
Definition: feed.php:28
$ini
Definition: raiseError.php:4

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

+ Here is the call graph for this function:

◆ testCopySkin()

ilSkinFactoryTest::testCopySkin ( )

Definition at line 85 of file ilSkinFactoryTest.php.

85 : void
86 {
87 $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
89
90 $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . 'Copy'));
91
92 $container_copy = $this->factory->copyFromSkinStyleContainer($container, $this->file_system, $this->message_stack);
93 $skin_copy = $container_copy->getSkin();
94
95 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . 'Copy'));
96 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
97 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1image'));
98 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1sound'));
99 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1font'));
100 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1css.css'));
101 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1css.less'));
102 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1css-variables.less'));
103
104 $this->assertEquals($skin->getName() . ' Copy', $skin_copy->getName());
105 $this->assertEquals('0.1', $skin_copy->getVersion());
106 }
ilSkinStyleContainer $container

References ilSystemStyleBaseFSTest\$container, $skin, ilSkin\getId(), ilSkin\getName(), and ilSkinStyleContainer\getSkin().

+ Here is the call graph for this function:

◆ testCopySkinWithInjectedName()

ilSkinFactoryTest::testCopySkinWithInjectedName ( )

Definition at line 108 of file ilSkinFactoryTest.php.

108 : void
109 {
110 $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
112 $container_copy = $this->factory->copyFromSkinStyleContainer($container, $this->file_system, $this->message_stack, 'inject');
113 $skin_copy = $container_copy->getSkin();
114
115 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . 'inject'));
116 $this->assertEquals($skin->getName() . ' inject', $skin_copy->getName());
117 $this->assertEquals('0.1', $skin_copy->getVersion());
118 }

References ilSystemStyleBaseFSTest\$container, $skin, ilSkin\getId(), ilSkin\getName(), and ilSkinStyleContainer\getSkin().

+ Here is the call graph for this function:

◆ testImportSkin()

ilSkinFactoryTest::testImportSkin ( )

Definition at line 120 of file ilSkinFactoryTest.php.

120 : void
121 {
122 $this->markTestSkipped('Unzipping is not possible due to missing dependencies');
123 return;
124
125 if (!defined('PATH_TO_ZIP')) {
126 if (file_exists('ilias.ini.php')) {
127 $ini = parse_ini_file('ilias.ini.php', true);
128 define('PATH_TO_ZIP', $ini['tools']['zip']);
129 } elseif (is_executable('/usr/bin/zip')) {
130 define('PATH_TO_ZIP', '/usr/bin/zip');
131 } else {
132 define('PATH_TO_ZIP', '');
133 }
134 }
135
136 if (!defined('PATH_TO_UNZIP')) {
137 if (file_exists('ilias.ini.php')) {
138 $ini = parse_ini_file('ilias.ini.php', true);
139 define('PATH_TO_UNZIP', $ini['tools']['unzip']);
140 } elseif (is_executable('/usr/bin/unzip')) {
141 define('PATH_TO_UNZIP', '/usr/bin/unzip');
142 } else {
143 define('PATH_TO_UNZIP', '');
144 }
145 }
146
147 //Only perform this test, if an unzip path has been found.
148 if (PATH_TO_UNZIP != '' && PATH_TO_ZIP != "") {
149 $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
151
152 $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . 'Copy'));
153
154 $container_import = $this->factory->skinStyleContainerFromZip(
156 $this->skin->getId() . '.zip',
157 $this->message_stack
158 );
159 $skin_copy = $container_import->getSkin();
160
161 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->getId() . 'Copy'));
162 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
163 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1image'));
164 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1sound'));
165 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1font'));
166 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1css.css'));
167 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1css.less'));
168 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . '/style1css-variables.less'));
169 } else {
170 $this->markTestIncomplete('No unzip has been detected on the system');
171 }
172 }
createTempZip()
Creates a temp zip file.

References ilSystemStyleBaseFSTest\$container, $ini, $skin, ilSkinStyleContainer\createTempZip(), ilSkin\getId(), and ilSkinStyleContainer\getSkin().

+ Here is the call graph for this function:

◆ testSkinFromXML()

ilSkinFactoryTest::testSkinFromXML ( )

Definition at line 65 of file ilSkinFactoryTest.php.

65 : void
66 {
67 $factory = new ilSkinFactory($this->lng);
68 $skin = $factory->skinFromXML($this->system_style_config->getCustomizingSkinPath() . 'skin1/template.xml');
69 $this->assertEquals(
70 $skin->asXML(),
71 file_get_contents($this->system_style_config->getCustomizingSkinPath() . 'skin1/template.xml')
72 );
73 }
ilSkinFactory $factory
asXML()
Stores the skin and all it's styles as xml.

References $factory, $skin, ilSkin\asXML(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ testSkinStyleContainerFromId()

ilSkinFactoryTest::testSkinStyleContainerFromId ( )

Definition at line 75 of file ilSkinFactoryTest.php.

75 : void
76 {
77 $container = $this->factory->skinStyleContainerFromId($this->skin->getId(), $this->message_stack);
78 $this->assertEquals($container->getSkin()->getId(), $this->skin->getId());
79 $this->assertEquals($container->getSkin()->getName(), $this->skin->getName());
80
81 $this->assertEquals($container->getSkin()->getStyle($this->style1->getId()), $this->style1);
82 $this->assertEquals($container->getSkin()->getStyle($this->style2->getId()), $this->style2);
83 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $factory

ilSkinFactory ilSkinFactoryTest::$factory
protected

Definition at line 28 of file ilSkinFactoryTest.php.

Referenced by testSkinFromXML().

◆ $skin

ilSkin ilSkinFactoryTest::$skin
protected

◆ $style1

ilSkinStyle ilSkinFactoryTest::$style1
protected

Definition at line 26 of file ilSkinFactoryTest.php.

◆ $style2

ilSkinStyle ilSkinFactoryTest::$style2
protected

Definition at line 27 of file ilSkinFactoryTest.php.


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