ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilSystemStyleSkinXMLTest Class Reference
+ Inheritance diagram for ilSystemStyleSkinXMLTest:
+ Collaboration diagram for ilSystemStyleSkinXMLTest:

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
 
 $save_dic = null
 

Detailed Description

Member Function Documentation

◆ setUp()

ilSystemStyleSkinXMLTest::setUp ( )
protected

Definition at line 40 of file ilSystemStyleSkinXMLTest.php.

References $DIC, and ilSystemStyleSkinContainer\xCopy().

41  {
42  global $DIC;
43 
44  $this->save_dic = $DIC;
45 
46  $this->skin = new ilSkinXML("skin1", "skin 1");
47 
48  $this->style1 = new ilSkinStyleXML("style1", "Style 1");
49  $this->style1->setCssFile("style1css");
50  $this->style1->setImageDirectory("style1image");
51  $this->style1->setSoundDirectory("style1sound");
52  $this->style1->setFontDirectory("style1font");
53 
54  $this->style2 = new ilSkinStyleXML("style2", "Style 2");
55  $this->style2->setCssFile("style2css");
56  $this->style2->setImageDirectory("style2image");
57  $this->style2->setSoundDirectory("style2sound");
58  $this->style2->setFontDirectory("style2font");
59 
60  $this->system_style_config = new ilSystemStyleConfigMock();
61 
62  mkdir($this->system_style_config->test_skin_temp_path);
63  ilSystemStyleSkinContainer::xCopy($this->system_style_config->test_skin_original_path, $this->system_style_config->test_skin_temp_path);
64  }
global $DIC
Definition: saml.php:7
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.
+ Here is the call graph for this function:

◆ tearDown()

ilSystemStyleSkinXMLTest::tearDown ( )
protected

Definition at line 66 of file ilSystemStyleSkinXMLTest.php.

References $DIC, $save_dic, and ilSystemStyleSkinContainer\recursiveRemoveDir().

67  {
68  global $DIC;
69  $DIC = $this->save_dic;
70 
71  ilSystemStyleSkinContainer::recursiveRemoveDir($this->system_style_config->test_skin_temp_path);
72  }
global $DIC
Definition: saml.php:7
static recursiveRemoveDir($dir)
Recursive delete of a folder.
+ Here is the call graph for this function:

◆ testAddStyle()

ilSystemStyleSkinXMLTest::testAddStyle ( )

Definition at line 80 of file ilSystemStyleSkinXMLTest.php.

81  {
82  $this->assertEquals(count($this->skin), 0);
83  $this->assertEquals(count($this->skin->getStyles()), 0);
84  $this->skin->addStyle($this->style1);
85  $this->assertEquals(count($this->skin), 1);
86  $this->assertEquals(count($this->skin->getStyles()), 1);
87  $this->skin->addStyle($this->style1);
88  $this->assertEquals(count($this->skin), 2);
89  $this->assertEquals(count($this->skin->getStyles()), 2);
90  $this->skin->addStyle($this->style2);
91  $this->assertEquals(count($this->skin), 3);
92  $this->assertEquals(count($this->skin->getStyles()), 3);
93  }

◆ testAsXML()

ilSystemStyleSkinXMLTest::testAsXML ( )

Definition at line 132 of file ilSystemStyleSkinXMLTest.php.

133  {
134  $this->skin->addStyle($this->style1);
135  $this->skin->addStyle($this->style2);
136  $this->assertEquals($this->skin->asXML(), file_get_contents($this->system_style_config->getCustomizingSkinPath() . "skin1/template.xml"));
137  }

◆ testGetStyles()

ilSystemStyleSkinXMLTest::testGetStyles ( )

Definition at line 95 of file ilSystemStyleSkinXMLTest.php.

References $style1, and $style2.

96  {
97  $this->skin->addStyle($this->style1);
98  $this->skin->addStyle($this->style2);
99 
100  $this->assertNotEquals($this->skin->getStyle("style2"), $this->style1);
101  $this->assertEquals($this->skin->getStyle("style2"), $this->style2);
102  }

◆ testReadXML()

ilSystemStyleSkinXMLTest::testReadXML ( )

Definition at line 148 of file ilSystemStyleSkinXMLTest.php.

References $skin.

149  {
150  $skin = ilSkinXML::parseFromXML($this->system_style_config->getCustomizingSkinPath() . "skin1/template.xml");
151  $this->assertEquals($skin->asXML(), file_get_contents($this->system_style_config->getCustomizingSkinPath() . "skin1/template.xml"));
152  }

◆ testRemoveStyles()

ilSystemStyleSkinXMLTest::testRemoveStyles ( )

Definition at line 104 of file ilSystemStyleSkinXMLTest.php.

105  {
106  $this->skin->addStyle($this->style1);
107  $this->skin->addStyle($this->style2);
108  $this->assertEquals(count($this->skin), 2);
109  $this->skin->removeStyle("style1");
110  $this->assertEquals(count($this->skin), 1);
111  $this->skin->removeStyle("style2");
112  $this->assertEquals(count($this->skin), 0);
113  }

◆ testRemoveTestTwice()

ilSystemStyleSkinXMLTest::testRemoveTestTwice ( )

Definition at line 115 of file ilSystemStyleSkinXMLTest.php.

References ilSystemStyleException\INVALID_ID.

116  {
117  $this->skin->addStyle($this->style1);
118  $this->skin->addStyle($this->style2);
119  $this->assertEquals(count($this->skin), 2);
120  $this->skin->removeStyle("style1");
121  $this->assertEquals(count($this->skin), 1);
122  $this->skin->removeStyle("style2");
123  $this->assertEquals(count($this->skin), 0);
124  try {
125  $this->skin->removeStyle("style2");
126  $this->assertTrue(false);
127  } catch (ilSystemStyleException $e) {
128  $this->assertEquals($e->getCode(), ilSystemStyleException::INVALID_ID);
129  }
130  }
Class for advanced editing exception handling in ILIAS.

◆ testSkinNameAndId()

ilSystemStyleSkinXMLTest::testSkinNameAndId ( )

Definition at line 74 of file ilSystemStyleSkinXMLTest.php.

75  {
76  $this->assertEquals("skin1", $this->skin->getId());
77  $this->assertEquals("skin 1", $this->skin->getName());
78  }

◆ testWriteXML()

ilSystemStyleSkinXMLTest::testWriteXML ( )

Definition at line 139 of file ilSystemStyleSkinXMLTest.php.

140  {
141  $this->skin->addStyle($this->style1);
142  $this->skin->addStyle($this->style2);
143  $this->skin->writeToXMLFile($this->system_style_config->getCustomizingSkinPath() . "skin1/template-copy.xml");
144  $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"));
145  unlink($this->system_style_config->getCustomizingSkinPath() . "skin1/template-copy.xml");
146  }

Field Documentation

◆ $save_dic

ilSystemStyleSkinXMLTest::$save_dic = null
protected

Definition at line 38 of file ilSystemStyleSkinXMLTest.php.

Referenced by tearDown().

◆ $skin

ilSystemStyleSkinXMLTest::$skin
protected

Definition at line 21 of file ilSystemStyleSkinXMLTest.php.

Referenced by testReadXML().

◆ $style1

ilSystemStyleSkinXMLTest::$style1 = null
protected

Definition at line 26 of file ilSystemStyleSkinXMLTest.php.

Referenced by testGetStyles().

◆ $style2

ilSystemStyleSkinXMLTest::$style2 = null
protected

Definition at line 31 of file ilSystemStyleSkinXMLTest.php.

Referenced by testGetStyles().

◆ $system_style_config

ilSystemStyleSkinXMLTest::$system_style_config
protected

Definition at line 36 of file ilSystemStyleSkinXMLTest.php.


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