ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilSkinXMLTest Class Reference
+ Inheritance diagram for ilSkinXMLTest:
+ Collaboration diagram for ilSkinXMLTest:

Public Member Functions

 testSkinNameAndId ()
 
 testAddStyle ()
 
 testGetStyles ()
 
 testRemoveStyles ()
 
 testRemoveTestTwice ()
 
 testAsXML ()
 
 testWriteXML ()
 
 testReadXML ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Protected Attributes

 $skin
 
 $style1 = null
 
 $style2 = null
 
 $system_style_config
 

Detailed Description

Author
Timon Amstutz timon.nosp@m..ams.nosp@m.tutz@.nosp@m.ilub.nosp@m..unib.nosp@m.e.ch
Version
$Id$*

Definition at line 16 of file ilSkinXMLTest.php.

Member Function Documentation

◆ setUp()

ilSkinXMLTest::setUp ( )
protected

Definition at line 40 of file ilSkinXMLTest.php.

40 : void
41 {
42 $this->skin = new ilSkinXML("skin1", "skin 1");
43
44 $this->style1 = new ilSkinStyleXML("style1", "Style 1");
45 $this->style1->setCssFile("style1css");
46 $this->style1->setImageDirectory("style1image");
47 $this->style1->setSoundDirectory("style1sound");
48 $this->style1->setFontDirectory("style1font");
49
50 $this->style2 = new ilSkinStyleXML("style2", "Style 2");
51 $this->style2->setCssFile("style2css");
52 $this->style2->setImageDirectory("style2image");
53 $this->style2->setSoundDirectory("style2sound");
54 $this->style2->setFontDirectory("style2font");
55
56 $this->system_style_config = new ilSystemStyleConfigMock();
57
58 mkdir($this->system_style_config->test_skin_temp_path);
59 ilSystemStyleSkinContainer::xCopy($this->system_style_config->test_skin_original_path, $this->system_style_config->test_skin_temp_path);
60 }
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...
static xCopy($src, $dest)
Recursive copy of a folder.

References ilSystemStyleSkinContainer\xCopy().

+ Here is the call graph for this function:

◆ tearDown()

ilSkinXMLTest::tearDown ( )
protected

Definition at line 62 of file ilSkinXMLTest.php.

62 : void
63 {
64 ilSystemStyleSkinContainer::recursiveRemoveDir($this->system_style_config->test_skin_temp_path);
65 }
static recursiveRemoveDir($dir)
Recursive delete of a folder.

References ilSystemStyleSkinContainer\recursiveRemoveDir().

+ Here is the call graph for this function:

◆ testAddStyle()

ilSkinXMLTest::testAddStyle ( )

Definition at line 73 of file ilSkinXMLTest.php.

74 {
75 $this->assertEquals(count($this->skin), 0);
76 $this->assertEquals(count($this->skin->getStyles()), 0);
77 $this->skin->addStyle($this->style1);
78 $this->assertEquals(count($this->skin), 1);
79 $this->assertEquals(count($this->skin->getStyles()), 1);
80 $this->skin->addStyle($this->style1);
81 $this->assertEquals(count($this->skin), 2);
82 $this->assertEquals(count($this->skin->getStyles()), 2);
83 $this->skin->addStyle($this->style2);
84 $this->assertEquals(count($this->skin), 3);
85 $this->assertEquals(count($this->skin->getStyles()), 3);
86 }

◆ testAsXML()

ilSkinXMLTest::testAsXML ( )

Definition at line 125 of file ilSkinXMLTest.php.

126 {
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"));
130 }

◆ testGetStyles()

ilSkinXMLTest::testGetStyles ( )

Definition at line 88 of file ilSkinXMLTest.php.

89 {
90 $this->skin->addStyle($this->style1);
91 $this->skin->addStyle($this->style2);
92
93 $this->assertNotEquals($this->skin->getStyle("style2"), $this->style1);
94 $this->assertEquals($this->skin->getStyle("style2"), $this->style2);
95 }

◆ testReadXML()

ilSkinXMLTest::testReadXML ( )

Definition at line 141 of file ilSkinXMLTest.php.

142 {
143 $skin = ilSkinXML::parseFromXML($this->system_style_config->getCustomizingSkinPath() . "skin1/template.xml");
144 $this->assertEquals($skin->asXML(), file_get_contents($this->system_style_config->getCustomizingSkinPath() . "skin1/template.xml"));
145 }

References $skin.

◆ testRemoveStyles()

ilSkinXMLTest::testRemoveStyles ( )

Definition at line 97 of file ilSkinXMLTest.php.

98 {
99 $this->skin->addStyle($this->style1);
100 $this->skin->addStyle($this->style2);
101 $this->assertEquals(count($this->skin), 2);
102 $this->skin->removeStyle("style1");
103 $this->assertEquals(count($this->skin), 1);
104 $this->skin->removeStyle("style2");
105 $this->assertEquals(count($this->skin), 0);
106 }

◆ testRemoveTestTwice()

ilSkinXMLTest::testRemoveTestTwice ( )

Definition at line 108 of file ilSkinXMLTest.php.

109 {
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);
117 try {
118 $this->skin->removeStyle("style2");
119 $this->assertTrue(false);
120 } catch (ilSystemStyleException $e) {
121 $this->assertEquals($e->getCode(), ilSystemStyleException::INVALID_ID);
122 }
123 }
Class for advanced editing exception handling in ILIAS.

References Vendor\Package\$e, and ilSystemStyleException\INVALID_ID.

◆ testSkinNameAndId()

ilSkinXMLTest::testSkinNameAndId ( )

Definition at line 67 of file ilSkinXMLTest.php.

68 {
69 $this->assertEquals("skin1", $this->skin->getId());
70 $this->assertEquals("skin 1", $this->skin->getName());
71 }

◆ testWriteXML()

ilSkinXMLTest::testWriteXML ( )

Definition at line 132 of file ilSkinXMLTest.php.

133 {
134 $this->skin->addStyle($this->style1);
135 $this->skin->addStyle($this->style2);
136 $this->skin->writeToXMLFile($this->system_style_config->getCustomizingSkinPath() . "skin1/template-copy.xml");
137 $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"));
138 unlink($this->system_style_config->getCustomizingSkinPath() . "skin1/template-copy.xml");
139 }

Field Documentation

◆ $skin

ilSkinXMLTest::$skin
protected

Definition at line 23 of file ilSkinXMLTest.php.

Referenced by testReadXML().

◆ $style1

ilSkinXMLTest::$style1 = null
protected

Definition at line 28 of file ilSkinXMLTest.php.

◆ $style2

ilSkinXMLTest::$style2 = null
protected

Definition at line 33 of file ilSkinXMLTest.php.

◆ $system_style_config

ilSkinXMLTest::$system_style_config
protected

Definition at line 38 of file ilSkinXMLTest.php.


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