ILIAS  release_7 Revision v7.30-3-g800a261c036
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 11 of file ComponentEntryDescriptionTest.php.

Member Function Documentation

◆ setUp()

ComponentEntryDescriptionTest::setUp ( )
protected

Definition at line 69 of file ComponentEntryDescriptionTest.php.

69 : void
70 {
71 $this->parser = new Crawler\EntriesYamlParser();
72 $this->proper_entry = new ProperEntryFixture();
73 }

◆ testCorrectDescription1()

ComponentEntryDescriptionTest::testCorrectDescription1 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 151 of file ComponentEntryDescriptionTest.php.

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

◆ testCorrectDescription2()

ComponentEntryDescriptionTest::testCorrectDescription2 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 160 of file ComponentEntryDescriptionTest.php.

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

◆ testEmptyDescription()

ComponentEntryDescriptionTest::testEmptyDescription ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 79 of file ComponentEntryDescriptionTest.php.

80 {
81 $description = new Entry\ComponentEntryDescription();
82 $this->assertEquals($this->empty_description_array, $description->getDescription());
83
84 $description = new Entry\ComponentEntryDescription(array());
85 $this->assertEquals($this->empty_description_array, $description->getDescription());
86 }

◆ testInvalidCategories1()

ComponentEntryDescriptionTest::testInvalidCategories1 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 103 of file ComponentEntryDescriptionTest.php.

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

References Vendor\Package\$e.

◆ testInvalidCategories2()

ComponentEntryDescriptionTest::testInvalidCategories2 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 115 of file ComponentEntryDescriptionTest.php.

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

References Vendor\Package\$e.

◆ testInvalidCategoryItem()

ComponentEntryDescriptionTest::testInvalidCategoryItem ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 127 of file ComponentEntryDescriptionTest.php.

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

References Vendor\Package\$e.

◆ testInvalidCategoryValue()

ComponentEntryDescriptionTest::testInvalidCategoryValue ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 139 of file ComponentEntryDescriptionTest.php.

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

References Vendor\Package\$e.

◆ testInvalidDescription()

ComponentEntryDescriptionTest::testInvalidDescription ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 90 of file ComponentEntryDescriptionTest.php.

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

References Vendor\Package\$e.

◆ testParseProperEntryToArray()

ComponentEntryDescriptionTest::testParseProperEntryToArray ( )

Definition at line 166 of file ComponentEntryDescriptionTest.php.

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

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 41 of file ComponentEntryDescriptionTest.php.

◆ $correct_description2_array

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

Definition at line 48 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 52 of file ComponentEntryDescriptionTest.php.

◆ $empty_description_array

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

Definition at line 17 of file ComponentEntryDescriptionTest.php.

◆ $invalid_categories1_array

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

Definition at line 24 of file ComponentEntryDescriptionTest.php.

◆ $invalid_categories2_array

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

Definition at line 28 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 32 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 36 of file ComponentEntryDescriptionTest.php.

◆ $parser

ComponentEntryDescriptionTest::$parser
protected

Definition at line 62 of file ComponentEntryDescriptionTest.php.

◆ $proper_entry

ComponentEntryDescriptionTest::$proper_entry
protected

Definition at line 67 of file ComponentEntryDescriptionTest.php.


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