ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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

array $empty_description_array
 
array $invalid_categories1_array
 
array $invalid_categories2_array
 
array $invalid_category_item_array
 
array $invalid_category_value_array
 
array $correct_description1_array
 
array $correct_description2_array
 
array $correct_description2_array_return
 
Crawler EntriesYamlParser $parser
 
ProperEntryFixture $proper_entry
 

Detailed Description

Definition at line 28 of file ComponentEntryDescriptionTest.php.

Member Function Documentation

◆ setUp()

ComponentEntryDescriptionTest::setUp ( )
protected

Definition at line 78 of file ComponentEntryDescriptionTest.php.

78 : void
79 {
80 $this->parser = new Crawler\EntriesYamlParser();
81 $this->proper_entry = new ProperEntryFixture();
82 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Fixture.php:20

◆ testCorrectDescription1()

ComponentEntryDescriptionTest::testCorrectDescription1 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 157 of file ComponentEntryDescriptionTest.php.

157 : void
158 {
159 $description = new Entry\ComponentEntryDescription($this->correct_description1_array);
160 $this->assertEquals($this->correct_description1_array, $description->getDescription());
161 }

◆ testCorrectDescription2()

ComponentEntryDescriptionTest::testCorrectDescription2 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 166 of file ComponentEntryDescriptionTest.php.

166 : void
167 {
168 $description = new Entry\ComponentEntryDescription($this->correct_description2_array);
169 $this->assertEquals($this->correct_description2_array_return, $description->getDescription());
170 }

◆ testEmptyDescription()

ComponentEntryDescriptionTest::testEmptyDescription ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 87 of file ComponentEntryDescriptionTest.php.

87 : void
88 {
89 $description = new Entry\ComponentEntryDescription();
90 $this->assertEquals($this->empty_description_array, $description->getDescription());
91
92 $description = new Entry\ComponentEntryDescription(array());
93 $this->assertEquals($this->empty_description_array, $description->getDescription());
94 }

◆ testInvalidCategories1()

ComponentEntryDescriptionTest::testInvalidCategories1 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 109 of file ComponentEntryDescriptionTest.php.

109 : void
110 {
111 try {
112 new Entry\ComponentEntryDescription($this->invalid_categories1_array);
113 $this->assertFalse("This should not happen");
114 } catch (Crawler\Exception\CrawlerException $e) {
115 $this->assertEquals(Crawler\Exception\CrawlerException::INVALID_INDEX, $e->getCode());
116 }
117 }

References Vendor\Package\$e.

◆ testInvalidCategories2()

ComponentEntryDescriptionTest::testInvalidCategories2 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 121 of file ComponentEntryDescriptionTest.php.

121 : void
122 {
123 try {
124 new Entry\ComponentEntryDescription($this->invalid_categories2_array);
125 $this->assertFalse("This should not happen");
126 } catch (Crawler\Exception\CrawlerException $e) {
127 $this->assertEquals(Crawler\Exception\CrawlerException::INVALID_INDEX, $e->getCode());
128 }
129 }

References Vendor\Package\$e.

◆ testInvalidCategoryItem()

ComponentEntryDescriptionTest::testInvalidCategoryItem ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 133 of file ComponentEntryDescriptionTest.php.

133 : void
134 {
135 try {
136 new Entry\ComponentEntryDescription($this->invalid_category_item_array);
137 $this->assertFalse("This should not happen");
138 } catch (Crawler\Exception\CrawlerException $e) {
139 $this->assertEquals(Crawler\Exception\CrawlerException::STRING_EXPECTED, $e->getCode());
140 }
141 }

References Vendor\Package\$e.

◆ testInvalidCategoryValue()

ComponentEntryDescriptionTest::testInvalidCategoryValue ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 145 of file ComponentEntryDescriptionTest.php.

145 : void
146 {
147 try {
148 new Entry\ComponentEntryDescription($this->invalid_category_value_array);
149 $this->assertFalse("This should not happen");
150 } catch (Crawler\Exception\CrawlerException $e) {
151 $this->assertEquals(Crawler\Exception\CrawlerException::STRING_EXPECTED, $e->getCode());
152 }
153 }

References Vendor\Package\$e.

◆ testInvalidDescription()

ComponentEntryDescriptionTest::testInvalidDescription ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 98 of file ComponentEntryDescriptionTest.php.

98 : void
99 {
100 $this->expectException(TypeError::class);
102
103 $this->expectException(TypeError::class);
105 }

◆ testParseProperEntryToArray()

ComponentEntryDescriptionTest::testParseProperEntryToArray ( )

Definition at line 172 of file ComponentEntryDescriptionTest.php.

172 : void
173 {
174 $entry = $this->parser->parseArrayFromFile("components/ILIAS/UI/tests/Crawler/Fixture/ProperEntry.php")[0];
175
176 $entry["description"]['composition'] = "";
177 $entry["description"]['effect'] = "";
178
179 $description = new Entry\ComponentEntryDescription($entry["description"]);
180
181 $this->assertEquals($description->getDescription(), $entry["description"]);
182 }

Field Documentation

◆ $correct_description1_array

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

Definition at line 57 of file ComponentEntryDescriptionTest.php.

◆ $correct_description2_array

array ComponentEntryDescriptionTest::$correct_description2_array
protected
Initial value:
= [
"purpose" => "Purpose Description"
]

Definition at line 64 of file ComponentEntryDescriptionTest.php.

◆ $correct_description2_array_return

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

Definition at line 68 of file ComponentEntryDescriptionTest.php.

◆ $empty_description_array

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

Definition at line 30 of file ComponentEntryDescriptionTest.php.

◆ $invalid_categories1_array

array ComponentEntryDescriptionTest::$invalid_categories1_array
protected
Initial value:
= [
"purpose",
"wrong"
]

Definition at line 37 of file ComponentEntryDescriptionTest.php.

◆ $invalid_categories2_array

array ComponentEntryDescriptionTest::$invalid_categories2_array
protected
Initial value:
= [
"purpose" => "",
"wrong" => ""
]

Definition at line 42 of file ComponentEntryDescriptionTest.php.

◆ $invalid_category_item_array

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

Definition at line 47 of file ComponentEntryDescriptionTest.php.

◆ $invalid_category_value_array

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

Definition at line 52 of file ComponentEntryDescriptionTest.php.

◆ $parser

Crawler EntriesYamlParser ComponentEntryDescriptionTest::$parser
protected

Definition at line 75 of file ComponentEntryDescriptionTest.php.

◆ $proper_entry

ProperEntryFixture ComponentEntryDescriptionTest::$proper_entry
protected

Definition at line 76 of file ComponentEntryDescriptionTest.php.


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