ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ComponentEntryRulesTest Class Reference
+ Inheritance diagram for ComponentEntryRulesTest:
+ Collaboration diagram for ComponentEntryRulesTest:

Public Member Functions

 testEmptyRules ()
 
 testHasRules ()
 
 testInvalidRules ()
 
 testInvalidCategories1 ()
 
 testInvalidCategories2 ()
 
 testInvalidCategoryItem ()
 
 testInvalidCategoryValue ()
 
 testCorrectRules1 ()
 
 testCorrectRules2 ()
 
 testParseProperEntryToArray ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

array $empty_rules_array
 
array $invalid_categories1_array
 
array $invalid_categories2_array
 
array $invalid_category_item_array
 
array $invalid_category_value_array
 
array $correct_rules1_array
 
array $correct_rules2_array
 
array $correct_rules2_array_return
 
Crawler EntriesYamlParser $parser
 
ProperEntryFixture $proper_entry
 

Detailed Description

Definition at line 28 of file ComponentEntryRulesTest.php.

Member Function Documentation

◆ setUp()

ComponentEntryRulesTest::setUp ( )
protected

Definition at line 91 of file ComponentEntryRulesTest.php.

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

◆ testCorrectRules1()

ComponentEntryRulesTest::testCorrectRules1 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 188 of file ComponentEntryRulesTest.php.

188 : void
189 {
190 $rules = new Entry\ComponentEntryRules($this->correct_rules1_array);
191 $this->assertEquals($this->correct_rules1_array, $rules->getRules());
192 }

◆ testCorrectRules2()

ComponentEntryRulesTest::testCorrectRules2 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 197 of file ComponentEntryRulesTest.php.

197 : void
198 {
199 $rules = new Entry\ComponentEntryRules($this->correct_rules2_array);
200 $this->assertEquals($this->correct_rules2_array_return, $rules->getRules());
201 }

◆ testEmptyRules()

ComponentEntryRulesTest::testEmptyRules ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 101 of file ComponentEntryRulesTest.php.

101 : void
102 {
103 $rule = new Entry\ComponentEntryRules();
104 $this->assertEquals($this->empty_rules_array, $rule->getRules());
105
106 $rule = new Entry\ComponentEntryRules(array());
107 $this->assertEquals($this->empty_rules_array, $rule->getRules());
108 }

◆ testHasRules()

ComponentEntryRulesTest::testHasRules ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 113 of file ComponentEntryRulesTest.php.

113 : void
114 {
115 $rules = new Entry\ComponentEntryRules($this->empty_rules_array);
116 $this->assertFalse($rules->hasRules());
117 $rules = new Entry\ComponentEntryRules($this->correct_rules1_array);
118 $this->assertTrue($rules->hasRules());
119 }

◆ testInvalidCategories1()

ComponentEntryRulesTest::testInvalidCategories1 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 136 of file ComponentEntryRulesTest.php.

136 : void
137 {
138 try {
139 new Entry\ComponentEntryRules($this->invalid_categories1_array);
140 $this->assertFalse("This should not happen");
141 } catch (Crawler\Exception\CrawlerException $e) {
142 $this->assertEquals(Crawler\Exception\CrawlerException::INVALID_INDEX, $e->getCode());
143 }
144 }

References Vendor\Package\$e.

◆ testInvalidCategories2()

ComponentEntryRulesTest::testInvalidCategories2 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 149 of file ComponentEntryRulesTest.php.

149 : void
150 {
151 try {
152 new Entry\ComponentEntryRules($this->invalid_categories2_array);
153 $this->assertFalse("This should not happen");
154 } catch (Crawler\Exception\CrawlerException $e) {
155 $this->assertEquals(Crawler\Exception\CrawlerException::INVALID_INDEX, $e->getCode());
156 }
157 }

References Vendor\Package\$e.

◆ testInvalidCategoryItem()

ComponentEntryRulesTest::testInvalidCategoryItem ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 162 of file ComponentEntryRulesTest.php.

162 : void
163 {
164 try {
165 new Entry\ComponentEntryRules($this->invalid_category_item_array);
166 $this->assertFalse("This should not happen");
167 } catch (Crawler\Exception\CrawlerException $e) {
168 $this->assertEquals(Crawler\Exception\CrawlerException::ARRAY_EXPECTED, $e->getCode());
169 }
170 }

References Vendor\Package\$e.

◆ testInvalidCategoryValue()

ComponentEntryRulesTest::testInvalidCategoryValue ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 175 of file ComponentEntryRulesTest.php.

175 : void
176 {
177 try {
178 new Entry\ComponentEntryRules($this->invalid_category_value_array);
179 $this->assertFalse("This should not happen");
180 } catch (Crawler\Exception\CrawlerException $e) {
181 $this->assertEquals(Crawler\Exception\CrawlerException::STRING_EXPECTED, $e->getCode());
182 }
183 }

References Vendor\Package\$e.

◆ testInvalidRules()

ComponentEntryRulesTest::testInvalidRules ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 124 of file ComponentEntryRulesTest.php.

124 : void
125 {
126 $this->expectException(TypeError::class);
128
129 $this->expectException(TypeError::class);
130 new Entry\ComponentEntryRules('rule1');
131 }

◆ testParseProperEntryToArray()

ComponentEntryRulesTest::testParseProperEntryToArray ( )

Definition at line 203 of file ComponentEntryRulesTest.php.

203 : void
204 {
205 $entry = $this->parser->parseArrayFromFile("components/ILIAS/UI/tests/Crawler/Fixture/ProperEntry.php")[0];
206
207 $entry["rules"]['composition'] = [];
208 $entry["rules"]['interaction'] = [];
209 $entry["rules"]['wording'] = [];
210 $entry["rules"]['ordering'] = [];
211 $entry["rules"]['responsiveness'] = [];
212 $entry["rules"]['accessibility'] = [];
213
214 $rules = new Entry\ComponentEntryRules($entry["rules"]);
215 $this->assertEquals($rules->getRules(), $entry["rules"]);
216 }

Field Documentation

◆ $correct_rules1_array

array ComponentEntryRulesTest::$correct_rules1_array
protected
Initial value:
= [
"usage" => [1 => "Usage Rule 1", 2 => "Usage Rule 2"],
"composition" => [1 => "composition Rule 1", 2 => "composition Rule 2"],
"interaction" => [1 => "interaction Rule 1", 2 => "interaction Rule 2"],
"wording" => [1 => "wording Rule 1", 2 => "wording Rule 2"],
"ordering" => [1 => "ordering Rule 1", 2 => "ordering Rule 2"],
"style" => [1 => "style Rule 1", 2 => "style Rule 2"],
"responsiveness" => [1 => "responsiveness Rule 1", 2 => "responsiveness Rule 2"],
"accessibility" => [1 => "accessibility Rule 1", 2 => "accessibility Rule 2"]
]

Definition at line 61 of file ComponentEntryRulesTest.php.

◆ $correct_rules2_array

array ComponentEntryRulesTest::$correct_rules2_array
protected
Initial value:
= [
"usage" => [1 => "Usage Rule 1", 2 => "Usage Rule 2"],
"accessibility" => ""
]

Definition at line 72 of file ComponentEntryRulesTest.php.

◆ $correct_rules2_array_return

array ComponentEntryRulesTest::$correct_rules2_array_return
protected
Initial value:
= [
"usage" => [1 => "Usage Rule 1", 2 => "Usage Rule 2"],
"composition" => [],
"interaction" => [],
"wording" => [],
"ordering" => [],
"style" => [],
"responsiveness" => [],
"accessibility" => []
]

Definition at line 77 of file ComponentEntryRulesTest.php.

◆ $empty_rules_array

array ComponentEntryRulesTest::$empty_rules_array
protected
Initial value:
= [
"usage" => [],
"composition" => [],
"interaction" => [],
"wording" => [],
"ordering" => [],
"style" => [],
"responsiveness" => [],
"accessibility" => []
]

Definition at line 30 of file ComponentEntryRulesTest.php.

◆ $invalid_categories1_array

array ComponentEntryRulesTest::$invalid_categories1_array
protected
Initial value:
= [
"usage",
"wrong"
]

Definition at line 41 of file ComponentEntryRulesTest.php.

◆ $invalid_categories2_array

array ComponentEntryRulesTest::$invalid_categories2_array
protected
Initial value:
= [
"usage" => [],
"wrong" => []
]

Definition at line 46 of file ComponentEntryRulesTest.php.

◆ $invalid_category_item_array

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

Definition at line 51 of file ComponentEntryRulesTest.php.

◆ $invalid_category_value_array

array ComponentEntryRulesTest::$invalid_category_value_array
protected
Initial value:
= [
"usage" => ["Correct"],
"composition" => [["wrong"]]
]

Definition at line 56 of file ComponentEntryRulesTest.php.

◆ $parser

Crawler EntriesYamlParser ComponentEntryRulesTest::$parser
protected

Definition at line 88 of file ComponentEntryRulesTest.php.

◆ $proper_entry

ProperEntryFixture ComponentEntryRulesTest::$proper_entry
protected

Definition at line 89 of file ComponentEntryRulesTest.php.


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