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

Member Function Documentation

◆ setUp()

ilSkinXMLTest::setUp ( )
protected

Definition at line 37 of file ilSkinXMLTest.php.

References ilSystemStyleSkinContainer\xCopy().

37  {
38  $this->skin = new ilSkinXML("skin1", "skin 1");
39 
40  $this->style1 = new ilSkinStyleXML("style1", "Style 1");
41  $this->style1->setCssFile("style1css");
42  $this->style1->setImageDirectory("style1image");
43  $this->style1->setSoundDirectory("style1sound");
44  $this->style1->setFontDirectory("style1font");
45 
46  $this->style2 = new ilSkinStyleXML("style2", "Style 2");
47  $this->style2->setCssFile("style2css");
48  $this->style2->setImageDirectory("style2image");
49  $this->style2->setSoundDirectory("style2sound");
50  $this->style2->setFontDirectory("style2font");
51 
52  $this->system_style_config = new ilSystemStyleConfigMock();
53 
54  mkdir($this->system_style_config->test_skin_temp_path);
55  ilSystemStyleSkinContainer::xCopy($this->system_style_config->test_skin_original_path,$this->system_style_config->test_skin_temp_path);
56  }
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()

ilSkinXMLTest::tearDown ( )
protected

Definition at line 58 of file ilSkinXMLTest.php.

References ilSystemStyleSkinContainer\recursiveRemoveDir().

58  {
59  ilSystemStyleSkinContainer::recursiveRemoveDir($this->system_style_config->test_skin_temp_path);
60  }
static recursiveRemoveDir($dir)
Recursive delete of a folder.
+ Here is the call graph for this function:

◆ testAddStyle()

ilSkinXMLTest::testAddStyle ( )

Definition at line 68 of file ilSkinXMLTest.php.

68  {
69  $this->assertEquals(count($this->skin),0);
70  $this->assertEquals(count($this->skin->getStyles()),0);
71  $this->skin->addStyle($this->style1);
72  $this->assertEquals(count($this->skin),1);
73  $this->assertEquals(count($this->skin->getStyles()),1);
74  $this->skin->addStyle($this->style1);
75  $this->assertEquals(count($this->skin),2);
76  $this->assertEquals(count($this->skin->getStyles()),2);
77  $this->skin->addStyle($this->style2);
78  $this->assertEquals(count($this->skin),3);
79  $this->assertEquals(count($this->skin->getStyles()),3);
80  }

◆ testAsXML()

ilSkinXMLTest::testAsXML ( )

Definition at line 117 of file ilSkinXMLTest.php.

117  {
118  $this->skin->addStyle($this->style1);
119  $this->skin->addStyle($this->style2);
120  $this->assertEquals($this->skin->asXML(),file_get_contents($this->system_style_config->getCustomizingSkinPath()."skin1/template.xml"));
121  }

◆ testGetStyles()

ilSkinXMLTest::testGetStyles ( )

Definition at line 82 of file ilSkinXMLTest.php.

References $style1, and $style2.

82  {
83  $this->skin->addStyle($this->style1);
84  $this->skin->addStyle($this->style2);
85 
86  $this->assertNotEquals($this->skin->getStyle("style2"),$this->style1);
87  $this->assertEquals($this->skin->getStyle("style2"),$this->style2);
88  }

◆ testReadXML()

ilSkinXMLTest::testReadXML ( )

Definition at line 132 of file ilSkinXMLTest.php.

References $skin.

132  {
133  $skin = ilSkinXML::parseFromXML($this->system_style_config->getCustomizingSkinPath()."skin1/template.xml");
134  $this->assertEquals($skin->asXML(),file_get_contents($this->system_style_config->getCustomizingSkinPath()."skin1/template.xml"));
135  }

◆ testRemoveStyles()

ilSkinXMLTest::testRemoveStyles ( )

Definition at line 90 of file ilSkinXMLTest.php.

90  {
91  $this->skin->addStyle($this->style1);
92  $this->skin->addStyle($this->style2);
93  $this->assertEquals(count($this->skin),2);
94  $this->skin->removeStyle("style1");
95  $this->assertEquals(count($this->skin),1);
96  $this->skin->removeStyle("style2");
97  $this->assertEquals(count($this->skin),0);
98  }

◆ testRemoveTestTwice()

ilSkinXMLTest::testRemoveTestTwice ( )

Definition at line 100 of file ilSkinXMLTest.php.

References ilSystemStyleException\INVALID_ID.

100  {
101  $this->skin->addStyle($this->style1);
102  $this->skin->addStyle($this->style2);
103  $this->assertEquals(count($this->skin),2);
104  $this->skin->removeStyle("style1");
105  $this->assertEquals(count($this->skin),1);
106  $this->skin->removeStyle("style2");
107  $this->assertEquals(count($this->skin),0);
108  try{
109  $this->skin->removeStyle("style2");
110  $this->assertTrue(false);
111  }catch(ilSystemStyleException $e){
112  $this->assertEquals($e->getCode(),ilSystemStyleException::INVALID_ID);
113  }
114 
115  }
Class for advanced editing exception handling in ILIAS.

◆ testSkinNameAndId()

ilSkinXMLTest::testSkinNameAndId ( )

Definition at line 62 of file ilSkinXMLTest.php.

62  {
63  $this->assertEquals("skin1", $this->skin->getId());
64  $this->assertEquals("skin 1", $this->skin->getName());
65 
66  }

◆ testWriteXML()

ilSkinXMLTest::testWriteXML ( )

Definition at line 123 of file ilSkinXMLTest.php.

123  {
124  $this->skin->addStyle($this->style1);
125  $this->skin->addStyle($this->style2);
126  $this->skin->writeToXMLFile($this->system_style_config->getCustomizingSkinPath()."skin1/template-copy.xml");
127  $this->assertEquals(file_get_contents($this->system_style_config->getCustomizingSkinPath()."skin1/template-copy.xml")
128  ,file_get_contents($this->system_style_config->getCustomizingSkinPath()."skin1/template.xml"));
129  unlink ($this->system_style_config->getCustomizingSkinPath()."skin1/template-copy.xml");
130  }

Field Documentation

◆ $skin

ilSkinXMLTest::$skin
protected

Definition at line 20 of file ilSkinXMLTest.php.

Referenced by testReadXML().

◆ $style1

ilSkinXMLTest::$style1 = null
protected

Definition at line 25 of file ilSkinXMLTest.php.

Referenced by testGetStyles().

◆ $style2

ilSkinXMLTest::$style2 = null
protected

Definition at line 30 of file ilSkinXMLTest.php.

Referenced by testGetStyles().

◆ $system_style_config

ilSkinXMLTest::$system_style_config
protected

Definition at line 35 of file ilSkinXMLTest.php.


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