ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 42 of file ilSystemStyleSkinXMLTest.php.

References $DIC, and ilSystemStyleSkinContainer\xCopy().

42  : void
43  {
44  global $DIC;
45 
46  $this->save_dic = $DIC;
47 
48  $this->skin = new ilSkinXML("skin1", "skin 1");
49 
50  $this->style1 = new ilSkinStyleXML("style1", "Style 1");
51  $this->style1->setCssFile("style1css");
52  $this->style1->setImageDirectory("style1image");
53  $this->style1->setSoundDirectory("style1sound");
54  $this->style1->setFontDirectory("style1font");
55 
56  $this->style2 = new ilSkinStyleXML("style2", "Style 2");
57  $this->style2->setCssFile("style2css");
58  $this->style2->setImageDirectory("style2image");
59  $this->style2->setSoundDirectory("style2sound");
60  $this->style2->setFontDirectory("style2font");
61 
62  $this->system_style_config = new ilSystemStyleConfigMock();
63 
64  mkdir($this->system_style_config->test_skin_temp_path);
65  ilSystemStyleSkinContainer::xCopy($this->system_style_config->test_skin_original_path, $this->system_style_config->test_skin_temp_path);
66  }
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin...
global $DIC
Definition: goto.php:24
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 68 of file ilSystemStyleSkinXMLTest.php.

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

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

◆ testAddStyle()

ilSystemStyleSkinXMLTest::testAddStyle ( )

Definition at line 82 of file ilSystemStyleSkinXMLTest.php.

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

◆ testAsXML()

ilSystemStyleSkinXMLTest::testAsXML ( )

Definition at line 134 of file ilSystemStyleSkinXMLTest.php.

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

◆ testGetStyles()

ilSystemStyleSkinXMLTest::testGetStyles ( )

Definition at line 97 of file ilSystemStyleSkinXMLTest.php.

References $style1, and $style2.

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

◆ testReadXML()

ilSystemStyleSkinXMLTest::testReadXML ( )

Definition at line 150 of file ilSystemStyleSkinXMLTest.php.

References $skin.

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

◆ testRemoveStyles()

ilSystemStyleSkinXMLTest::testRemoveStyles ( )

Definition at line 106 of file ilSystemStyleSkinXMLTest.php.

107  {
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);
115  }

◆ testRemoveTestTwice()

ilSystemStyleSkinXMLTest::testRemoveTestTwice ( )

Definition at line 117 of file ilSystemStyleSkinXMLTest.php.

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

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

◆ testSkinNameAndId()

ilSystemStyleSkinXMLTest::testSkinNameAndId ( )

Definition at line 76 of file ilSystemStyleSkinXMLTest.php.

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

◆ testWriteXML()

ilSystemStyleSkinXMLTest::testWriteXML ( )

Definition at line 141 of file ilSystemStyleSkinXMLTest.php.

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

Field Documentation

◆ $save_dic

ilSystemStyleSkinXMLTest::$save_dic = null
protected

Definition at line 40 of file ilSystemStyleSkinXMLTest.php.

Referenced by tearDown().

◆ $skin

ilSystemStyleSkinXMLTest::$skin
protected

Definition at line 23 of file ilSystemStyleSkinXMLTest.php.

Referenced by testReadXML().

◆ $style1

ilSystemStyleSkinXMLTest::$style1 = null
protected

Definition at line 28 of file ilSystemStyleSkinXMLTest.php.

Referenced by testGetStyles().

◆ $style2

ilSystemStyleSkinXMLTest::$style2 = null
protected

Definition at line 33 of file ilSystemStyleSkinXMLTest.php.

Referenced by testGetStyles().

◆ $system_style_config

ilSystemStyleSkinXMLTest::$system_style_config
protected

Definition at line 38 of file ilSystemStyleSkinXMLTest.php.


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