ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 39 of file ilSystemStyleSkinXMLTest.php.

References $DIC, and ilSystemStyleSkinContainer\xCopy().

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

◆ tearDown()

ilSystemStyleSkinXMLTest::tearDown ( )
protected

Definition at line 64 of file ilSystemStyleSkinXMLTest.php.

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

64  {
65  global $DIC;
66  $DIC = $this->save_dic;
67 
68  ilSystemStyleSkinContainer::recursiveRemoveDir($this->system_style_config->test_skin_temp_path);
69  }
static recursiveRemoveDir($dir)
Recursive delete of a folder.
global $DIC
+ Here is the call graph for this function:

◆ testAddStyle()

ilSystemStyleSkinXMLTest::testAddStyle ( )

Definition at line 77 of file ilSystemStyleSkinXMLTest.php.

77  {
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);
89  }

◆ testAsXML()

ilSystemStyleSkinXMLTest::testAsXML ( )

Definition at line 126 of file ilSystemStyleSkinXMLTest.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()

ilSystemStyleSkinXMLTest::testGetStyles ( )

Definition at line 91 of file ilSystemStyleSkinXMLTest.php.

References $style1, and $style2.

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

◆ testReadXML()

ilSystemStyleSkinXMLTest::testReadXML ( )

Definition at line 141 of file ilSystemStyleSkinXMLTest.php.

References $skin.

141  {
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"));
144  }

◆ testRemoveStyles()

ilSystemStyleSkinXMLTest::testRemoveStyles ( )

Definition at line 99 of file ilSystemStyleSkinXMLTest.php.

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

◆ testRemoveTestTwice()

ilSystemStyleSkinXMLTest::testRemoveTestTwice ( )

Definition at line 109 of file ilSystemStyleSkinXMLTest.php.

References ilSystemStyleException\INVALID_ID.

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 
124  }
Class for advanced editing exception handling in ILIAS.

◆ testSkinNameAndId()

ilSystemStyleSkinXMLTest::testSkinNameAndId ( )

Definition at line 71 of file ilSystemStyleSkinXMLTest.php.

71  {
72  $this->assertEquals("skin1", $this->skin->getId());
73  $this->assertEquals("skin 1", $this->skin->getName());
74 
75  }

◆ testWriteXML()

ilSystemStyleSkinXMLTest::testWriteXML ( )

Definition at line 132 of file ilSystemStyleSkinXMLTest.php.

132  {
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");
139  }

Field Documentation

◆ $save_dic

ilSystemStyleSkinXMLTest::$save_dic = null
protected

Definition at line 37 of file ilSystemStyleSkinXMLTest.php.

Referenced by tearDown().

◆ $skin

ilSystemStyleSkinXMLTest::$skin
protected

Definition at line 20 of file ilSystemStyleSkinXMLTest.php.

Referenced by testReadXML().

◆ $style1

ilSystemStyleSkinXMLTest::$style1 = null
protected

Definition at line 25 of file ilSystemStyleSkinXMLTest.php.

Referenced by testGetStyles().

◆ $style2

ilSystemStyleSkinXMLTest::$style2 = null
protected

Definition at line 30 of file ilSystemStyleSkinXMLTest.php.

Referenced by testGetStyles().

◆ $system_style_config

ilSystemStyleSkinXMLTest::$system_style_config
protected

Definition at line 35 of file ilSystemStyleSkinXMLTest.php.


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