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

Public Member Functions

 testEmptyDescription ()
 
 testInvalidDescription ()
 
 testInvalidCategories1 ()
 
 testInvalidCategories2 ()
 
 testInvalidCategoryItem ()
 
 testInvalidCategoryValue ()
 
 testCorrectDescription1 ()
 
 testCorrectDescription2 ()
 
 testParseProperEntryToArray ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $empty_description_array
 
 $invalid_categories1_array
 
 $invalid_categories2_array
 
 $invalid_category_item_array
 
 $invalid_category_value_array
 
 $correct_description1_array
 
 $correct_description2_array
 
 $correct_description2_array_return
 
 $parser
 
 $proper_entry
 

Detailed Description

Definition at line 10 of file ComponentEntryDescriptionTest.php.

Member Function Documentation

◆ setUp()

ComponentEntryDescriptionTest::setUp ( )
protected

Definition at line 68 of file ComponentEntryDescriptionTest.php.

◆ testCorrectDescription1()

ComponentEntryDescriptionTest::testCorrectDescription1 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 150 of file ComponentEntryDescriptionTest.php.

151 {
152 $description = new Entry\ComponentEntryDescription($this->correct_description1_array);
153 $this->assertEquals($this->correct_description1_array, $description->getDescription());
154 }

References $description.

◆ testCorrectDescription2()

ComponentEntryDescriptionTest::testCorrectDescription2 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 159 of file ComponentEntryDescriptionTest.php.

160 {
161 $description = new Entry\ComponentEntryDescription($this->correct_description2_array);
162 $this->assertEquals($this->correct_description2_array_return, $description->getDescription());
163 }

References $description.

◆ testEmptyDescription()

ComponentEntryDescriptionTest::testEmptyDescription ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 78 of file ComponentEntryDescriptionTest.php.

79 {
81 $this->assertEquals($this->empty_description_array, $description->getDescription());
82
84 $this->assertEquals($this->empty_description_array, $description->getDescription());
85 }

References $description.

◆ testInvalidCategories1()

ComponentEntryDescriptionTest::testInvalidCategories1 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 102 of file ComponentEntryDescriptionTest.php.

103 {
104 try {
105 new Entry\ComponentEntryDescription($this->invalid_categories1_array);
106 $this->assertFalse("This should not happen");
107 } catch (Crawler\Exception\CrawlerException $e) {
108 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::INVALID_INDEX);
109 }
110 }

◆ testInvalidCategories2()

ComponentEntryDescriptionTest::testInvalidCategories2 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 114 of file ComponentEntryDescriptionTest.php.

115 {
116 try {
117 new Entry\ComponentEntryDescription($this->invalid_categories2_array);
118 $this->assertFalse("This should not happen");
119 } catch (Crawler\Exception\CrawlerException $e) {
120 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::INVALID_INDEX);
121 }
122 }

◆ testInvalidCategoryItem()

ComponentEntryDescriptionTest::testInvalidCategoryItem ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 126 of file ComponentEntryDescriptionTest.php.

127 {
128 try {
129 new Entry\ComponentEntryDescription($this->invalid_category_item_array);
130 $this->assertFalse("This should not happen");
131 } catch (Crawler\Exception\CrawlerException $e) {
132 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::STRING_EXPECTED);
133 }
134 }

◆ testInvalidCategoryValue()

ComponentEntryDescriptionTest::testInvalidCategoryValue ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 138 of file ComponentEntryDescriptionTest.php.

139 {
140 try {
141 new Entry\ComponentEntryDescription($this->invalid_category_value_array);
142 $this->assertFalse("This should not happen");
143 } catch (Crawler\Exception\CrawlerException $e) {
144 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::STRING_EXPECTED);
145 }
146 }

◆ testInvalidDescription()

ComponentEntryDescriptionTest::testInvalidDescription ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 89 of file ComponentEntryDescriptionTest.php.

90 {
91 try {
94 $this->assertFalse("This should not happen");
95 } catch (Crawler\Exception\CrawlerException $e) {
96 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::ARRAY_EXPECTED);
97 }
98 }

◆ testParseProperEntryToArray()

ComponentEntryDescriptionTest::testParseProperEntryToArray ( )

Definition at line 165 of file ComponentEntryDescriptionTest.php.

166 {
167 $entry = $this->parser->parseArrayFromFile("tests/UI/Crawler/Fixture/ProperEntry.php")[0];
168
169 $entry["description"]['composition'] = "";
170 $entry["description"]['effect'] = "";
171
172 $description = new Entry\ComponentEntryDescription($entry["description"]);
173
174 $this->assertEquals($description->getDescription(), $entry["description"]);
175 }

References $description.

Field Documentation

◆ $correct_description1_array

ComponentEntryDescriptionTest::$correct_description1_array
protected
Initial value:
= array(
"purpose"=>"Purpose Description",
"composition"=>"Composition Description",
"effect"=>"Effect Description",
"rivals"=>array("Element 1" => "Rival 1", "Element 2" => "Rival 2")
)

Definition at line 40 of file ComponentEntryDescriptionTest.php.

◆ $correct_description2_array

ComponentEntryDescriptionTest::$correct_description2_array
protected
Initial value:
= array(
"purpose"=>"Purpose Description"
)

Definition at line 47 of file ComponentEntryDescriptionTest.php.

◆ $correct_description2_array_return

ComponentEntryDescriptionTest::$correct_description2_array_return
protected
Initial value:
= array(
"purpose"=>"Purpose Description",
"composition"=>"",
"effect"=>"",
"rivals"=>array()
)

Definition at line 51 of file ComponentEntryDescriptionTest.php.

◆ $empty_description_array

ComponentEntryDescriptionTest::$empty_description_array
protected
Initial value:
= array(
"purpose"=>"",
"composition"=>"",
"effect"=>"",
"rivals"=>array()
)

Definition at line 16 of file ComponentEntryDescriptionTest.php.

◆ $invalid_categories1_array

ComponentEntryDescriptionTest::$invalid_categories1_array
protected
Initial value:
= array(
"purpose",
"wrong"
)

Definition at line 23 of file ComponentEntryDescriptionTest.php.

◆ $invalid_categories2_array

ComponentEntryDescriptionTest::$invalid_categories2_array
protected
Initial value:
= array(
"purpose"=>"",
"wrong"=>""
)

Definition at line 27 of file ComponentEntryDescriptionTest.php.

◆ $invalid_category_item_array

ComponentEntryDescriptionTest::$invalid_category_item_array
protected
Initial value:
= array(
"purpose"=>"Correct",
"composition"=>array("Wrong")
)

Definition at line 31 of file ComponentEntryDescriptionTest.php.

◆ $invalid_category_value_array

ComponentEntryDescriptionTest::$invalid_category_value_array
protected
Initial value:
= array(
"purpose"=>"Correct",
"rivals"=>array(array("wrong"))
)

Definition at line 35 of file ComponentEntryDescriptionTest.php.

◆ $parser

ComponentEntryDescriptionTest::$parser
protected

Definition at line 61 of file ComponentEntryDescriptionTest.php.

◆ $proper_entry

ComponentEntryDescriptionTest::$proper_entry
protected

Definition at line 66 of file ComponentEntryDescriptionTest.php.


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