4include_once(
"./Services/Style/System/classes/Utilities/class.ilSkinStyleXML.php");
5include_once(
"./Services/Style/System/classes/Utilities/class.ilSkinXML.php");
6include_once(
"./Services/Style/System/test/fixtures/mocks/ilSystemStyleConfigMock.php");
7include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
42 $this->save_dic =
$DIC;
44 $this->skin =
new ilSkinXML(
"skin1",
"skin 1");
47 $this->style1->setCssFile(
"style1css");
48 $this->style1->setImageDirectory(
"style1image");
49 $this->style1->setSoundDirectory(
"style1sound");
50 $this->style1->setFontDirectory(
"style1font");
53 $this->style2->setCssFile(
"style2css");
54 $this->style2->setImageDirectory(
"style2image");
55 $this->style2->setSoundDirectory(
"style2sound");
56 $this->style2->setFontDirectory(
"style2font");
60 mkdir($this->system_style_config->test_skin_temp_path);
72 $this->assertEquals(
"skin1", $this->skin->getId());
73 $this->assertEquals(
"skin 1", $this->skin->getName());
78 $this->assertEquals(count($this->skin),0);
79 $this->assertEquals(count($this->skin->getStyles()),0);
80 $this->skin->addStyle($this->style1);
81 $this->assertEquals(count($this->skin),1);
82 $this->assertEquals(count($this->skin->getStyles()),1);
83 $this->skin->addStyle($this->style1);
84 $this->assertEquals(count($this->skin),2);
85 $this->assertEquals(count($this->skin->getStyles()),2);
86 $this->skin->addStyle($this->style2);
87 $this->assertEquals(count($this->skin),3);
88 $this->assertEquals(count($this->skin->getStyles()),3);
92 $this->skin->addStyle($this->style1);
93 $this->skin->addStyle($this->style2);
95 $this->assertNotEquals($this->skin->getStyle(
"style2"),$this->style1);
96 $this->assertEquals($this->skin->getStyle(
"style2"),$this->style2);
100 $this->skin->addStyle($this->style1);
101 $this->skin->addStyle($this->style2);
102 $this->assertEquals(count($this->skin),2);
103 $this->skin->removeStyle(
"style1");
104 $this->assertEquals(count($this->skin),1);
105 $this->skin->removeStyle(
"style2");
106 $this->assertEquals(count($this->skin),0);
110 $this->skin->addStyle($this->style1);
111 $this->skin->addStyle($this->style2);
112 $this->assertEquals(count($this->skin),2);
113 $this->skin->removeStyle(
"style1");
114 $this->assertEquals(count($this->skin),1);
115 $this->skin->removeStyle(
"style2");
116 $this->assertEquals(count($this->skin),0);
118 $this->skin->removeStyle(
"style2");
119 $this->assertTrue(
false);
127 $this->skin->addStyle($this->style1);
128 $this->skin->addStyle($this->style2);
129 $this->assertEquals($this->skin->asXML(),file_get_contents($this->system_style_config->getCustomizingSkinPath().
"skin1/template.xml"));
133 $this->skin->addStyle($this->style1);
134 $this->skin->addStyle($this->style2);
135 $this->skin->writeToXMLFile($this->system_style_config->getCustomizingSkinPath().
"skin1/template-copy.xml");
136 $this->assertEquals(file_get_contents($this->system_style_config->getCustomizingSkinPath().
"skin1/template-copy.xml")
137 ,file_get_contents($this->system_style_config->getCustomizingSkinPath().
"skin1/template.xml"));
138 unlink ($this->system_style_config->getCustomizingSkinPath().
"skin1/template-copy.xml");
142 $skin = ilSkinXML::parseFromXML($this->system_style_config->getCustomizingSkinPath().
"skin1/template.xml");
143 $this->assertEquals(
$skin->asXML(),file_get_contents($this->system_style_config->getCustomizingSkinPath().
"skin1/template.xml"));
An exception for terminatinating execution or to throw for unit testing.
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...
Class for advanced editing exception handling in ILIAS.
static recursiveRemoveDir($dir)
Recursive delete of a folder.
static xCopy($src, $dest)
Recursive copy of a folder.