19 declare(strict_types=1);
21 require_once(
'libs/composer/vendor/autoload.php');
30 protected function setUp(): void
34 if (!defined(
'PATH_TO_SCSS')) {
35 if (file_exists(
'ilias.ini.php')) {
36 $ini = parse_ini_file(
'ilias.ini.php',
true);
37 define(
'PATH_TO_SCSS',
$ini[
'tools'][
'lessc'] ??
'');
39 define(
'PATH_TO_SCSS',
'');
43 $this->skin =
new ilSkin(
'skin1',
'skin 1');
45 $this->style1 =
new ilSkinStyle(
'style1',
'Style 1');
46 $this->style1->setCssFile(
'style1');
47 $this->style1->setImageDirectory(
'style1image');
48 $this->style1->setSoundDirectory(
'style1sound');
49 $this->style1->setFontDirectory(
'style1font');
51 $this->style2 =
new ilSkinStyle(
'style2',
'Style 2');
52 $this->style2->setCssFile(
'style2');
53 $this->style2->setImageDirectory(
'style2image');
54 $this->style2->setSoundDirectory(
'style2sound');
55 $this->style2->setFontDirectory(
'style2font');
62 $DIC[
'tpl'] = $this->getMockBuilder(ilGlobalTemplateInterface::class)->getMock();
68 $skin = $factory->skinFromXML($this->system_style_config->getCustomizingSkinPath() .
'skin1/template.xml');
71 file_get_contents($this->system_style_config->getCustomizingSkinPath() .
'skin1/template.xml')
81 $this->assertEquals(
$container->
getSkin()->getStyle($this->style1->getId()), $this->style1);
82 $this->assertEquals(
$container->
getSkin()->getStyle($this->style2->getId()), $this->style2);
90 $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->
getId() .
'Copy'));
92 $container_copy = $this->factory->copyFromSkinStyleContainer(
$container, $this->file_system, $this->message_stack);
93 $skin_copy = $container_copy->getSkin();
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() .
'/style1/style1image'));
98 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1/style1sound'));
99 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1/style1font'));
100 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1/style1.css'));
101 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1/style1.scss'));
102 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1/010-settings/variables1.scss'));
103 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1/010-settings/variables2.scss'));
105 $this->assertEquals($skin->
getName() .
' Copy', $skin_copy->getName());
106 $this->assertEquals(
'0.1', $skin_copy->getVersion());
113 $container_copy = $this->factory->copyFromSkinStyleContainer(
$container, $this->file_system, $this->message_stack,
'inject');
114 $skin_copy = $container_copy->getSkin();
116 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->
getId() .
'inject'));
117 $this->assertEquals($skin->
getName() .
' inject', $skin_copy->getName());
118 $this->assertEquals(
'0.1', $skin_copy->getVersion());
123 $this->markTestSkipped(
'This test is skipped, because it is not possible to create a zip file, which can be unzipped at the moment in Test-Context. The test is violating thr policy to access only directories which are known to the LegacyPathHelper.');
126 if (!defined(
'PATH_TO_ZIP')) {
127 if (file_exists(
'ilias.ini.php')) {
128 $ini = parse_ini_file(
'ilias.ini.php',
true);
129 define(
'PATH_TO_ZIP',
$ini[
'tools'][
'zip']);
130 } elseif (is_executable(
'/usr/bin/zip')) {
131 define(
'PATH_TO_ZIP',
'/usr/bin/zip');
133 define(
'PATH_TO_ZIP',
'');
137 if (!defined(
'PATH_TO_UNZIP')) {
138 if (file_exists(
'ilias.ini.php')) {
139 $ini = parse_ini_file(
'ilias.ini.php',
true);
140 define(
'PATH_TO_UNZIP',
$ini[
'tools'][
'unzip']);
141 } elseif (is_executable(
'/usr/bin/unzip')) {
142 define(
'PATH_TO_UNZIP',
'/usr/bin/unzip');
144 define(
'PATH_TO_UNZIP',
'');
149 if (PATH_TO_UNZIP !=
'' && PATH_TO_ZIP !=
"") {
153 $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->
getId() .
'Copy'));
155 $container_import = $this->factory->skinStyleContainerFromZip(
157 $this->skin->getId() .
'.zip',
160 $skin_copy = $container_import->getSkin();
162 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin->
getId() .
'Copy'));
163 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
164 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1image'));
165 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1sound'));
166 $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1font'));
167 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1css.css'));
168 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1css.less'));
169 $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() .
'/style1css-variables.less'));
171 $this->markTestIncomplete(
'No unzip has been detected on the system');
Factory to create Skin classes holds an manages the basic data of a skin as provide by the template o...
testSkinStyleContainerFromId()
asXML()
Stores the skin and all it's styles as xml.
ilSystemStyleMessageStack $message_stack
createTempZip()
Creates a temp zip file.
testCopySkinWithInjectedName()
ilSkinStyleContainer $container
ilSkin holds an manages the basic data of a skin as provide by the template of the skin...