4 include_once(
"./Services/Style/System/classes/Utilities/class.ilSkinStyleXML.php");
5 include_once(
"./Services/Style/System/classes/Utilities/class.ilSkinXML.php");
6 include_once(
"./Services/Style/System/test/fixtures/mocks/ilSystemStyleConfigMock.php");
7 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
40 $this->skin =
new ilSkinXML(
"skin1",
"skin 1");
43 $this->style1->setCssFile(
"style1css");
44 $this->style1->setImageDirectory(
"style1image");
45 $this->style1->setSoundDirectory(
"style1sound");
46 $this->style1->setFontDirectory(
"style1font");
49 $this->style2->setCssFile(
"style2css");
50 $this->style2->setImageDirectory(
"style2image");
51 $this->style2->setSoundDirectory(
"style2sound");
52 $this->style2->setFontDirectory(
"style2font");
56 mkdir($this->system_style_config->test_skin_temp_path);
67 $this->assertEquals(
"skin1", $this->skin->getId());
68 $this->assertEquals(
"skin 1", $this->skin->getName());
73 $this->assertEquals(count($this->skin), 0);
74 $this->assertEquals(count($this->skin->getStyles()), 0);
75 $this->skin->addStyle($this->style1);
76 $this->assertEquals(count($this->skin), 1);
77 $this->assertEquals(count($this->skin->getStyles()), 1);
78 $this->skin->addStyle($this->style1);
79 $this->assertEquals(count($this->skin), 2);
80 $this->assertEquals(count($this->skin->getStyles()), 2);
81 $this->skin->addStyle($this->style2);
82 $this->assertEquals(count($this->skin), 3);
83 $this->assertEquals(count($this->skin->getStyles()), 3);
88 $this->skin->addStyle($this->style1);
89 $this->skin->addStyle($this->style2);
91 $this->assertNotEquals($this->skin->getStyle(
"style2"),
$this->style1);
92 $this->assertEquals($this->skin->getStyle(
"style2"),
$this->style2);
97 $this->skin->addStyle($this->style1);
98 $this->skin->addStyle($this->style2);
99 $this->assertEquals(count($this->skin), 2);
100 $this->skin->removeStyle(
"style1");
101 $this->assertEquals(count($this->skin), 1);
102 $this->skin->removeStyle(
"style2");
103 $this->assertEquals(count($this->skin), 0);
108 $this->skin->addStyle($this->style1);
109 $this->skin->addStyle($this->style2);
110 $this->assertEquals(count($this->skin), 2);
111 $this->skin->removeStyle(
"style1");
112 $this->assertEquals(count($this->skin), 1);
113 $this->skin->removeStyle(
"style2");
114 $this->assertEquals(count($this->skin), 0);
116 $this->skin->removeStyle(
"style2");
117 $this->assertTrue(
false);
125 $this->skin->addStyle($this->style1);
126 $this->skin->addStyle($this->style2);
127 $this->assertEquals($this->skin->asXML(), file_get_contents($this->system_style_config->getCustomizingSkinPath() .
"skin1/template.xml"));
132 $this->skin->addStyle($this->style1);
133 $this->skin->addStyle($this->style2);
134 $this->skin->writeToXMLFile($this->system_style_config->getCustomizingSkinPath() .
"skin1/template-copy.xml");
135 $this->assertEquals(file_get_contents($this->system_style_config->getCustomizingSkinPath() .
"skin1/template-copy.xml"), file_get_contents($this->system_style_config->getCustomizingSkinPath() .
"skin1/template.xml"));
136 unlink($this->system_style_config->getCustomizingSkinPath() .
"skin1/template-copy.xml");
141 $skin = ilSkinXML::parseFromXML($this->system_style_config->getCustomizingSkinPath() .
"skin1/template.xml");
142 $this->assertEquals(
$skin->asXML(), file_get_contents($this->system_style_config->getCustomizingSkinPath() .
"skin1/template.xml"));
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin...
static recursiveRemoveDir($dir)
Recursive delete of a folder.
Class for advanced editing exception handling in ILIAS.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
static xCopy($src, $dest)
Recursive copy of a folder.