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

Public Member Functions

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

Protected Member Functions

 setUp ()
 

Protected Attributes

 $empty_rules_array
 
 $invalid_categories1_array
 
 $invalid_categories2_array
 
 $invalid_category_item_array
 
 $invalid_category_value_array
 
 $correct_rules1_array
 
 $correct_rules2_array
 
 $correct_rules2_array_return
 
 $parser
 
 $proper_entry
 

Detailed Description

Definition at line 10 of file ComponentEntryRulesTest.php.

Member Function Documentation

◆ setUp()

ComponentEntryRulesTest::setUp ( )
protected

Definition at line 73 of file ComponentEntryRulesTest.php.

◆ testCorrectRules1()

ComponentEntryRulesTest::testCorrectRules1 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 155 of file ComponentEntryRulesTest.php.

156 {
157 $rules = new Entry\ComponentEntryRules($this->correct_rules1_array);
158 $this->assertEquals($this->correct_rules1_array, $rules->getRules());
159 }

◆ testCorrectRules2()

ComponentEntryRulesTest::testCorrectRules2 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 164 of file ComponentEntryRulesTest.php.

165 {
166 $rules = new Entry\ComponentEntryRules($this->correct_rules2_array);
167 $this->assertEquals($this->correct_rules2_array_return, $rules->getRules());
168 }

◆ testEmptyRules()

ComponentEntryRulesTest::testEmptyRules ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 83 of file ComponentEntryRulesTest.php.

84 {
86 $this->assertEquals($this->empty_rules_array, $rule->getRules());
87
88 $rule = new Entry\ComponentEntryRules(array());
89 $this->assertEquals($this->empty_rules_array, $rule->getRules());
90 }
$rule
Definition: showstats.php:43

References $rule.

◆ testInvalidCategories1()

ComponentEntryRulesTest::testInvalidCategories1 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 107 of file ComponentEntryRulesTest.php.

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

◆ testInvalidCategories2()

ComponentEntryRulesTest::testInvalidCategories2 ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 119 of file ComponentEntryRulesTest.php.

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

◆ testInvalidCategoryItem()

ComponentEntryRulesTest::testInvalidCategoryItem ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 131 of file ComponentEntryRulesTest.php.

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

◆ testInvalidCategoryValue()

ComponentEntryRulesTest::testInvalidCategoryValue ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 143 of file ComponentEntryRulesTest.php.

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

◆ testInvalidRules()

ComponentEntryRulesTest::testInvalidRules ( )
Exceptions
Crawler

Exception\CrawlerException

Definition at line 94 of file ComponentEntryRulesTest.php.

95 {
96 try {
98 new Entry\ComponentEntryRules("rule1");
99 $this->assertFalse("This should not happen");
100 } catch (Crawler\Exception\CrawlerException $e) {
101 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::ARRAY_EXPECTED);
102 }
103 }

◆ testParseProperEntryToArray()

ComponentEntryRulesTest::testParseProperEntryToArray ( )

Definition at line 170 of file ComponentEntryRulesTest.php.

171 {
172 $entry = $this->parser->parseArrayFromFile("tests/UI/Crawler/Fixture/ProperEntry.php")[0];
173
174 $entry["rules"]['composition'] = array();
175 $entry["rules"]['interaction'] = array();
176 $entry["rules"]['wording'] = array();
177 $entry["rules"]['ordering'] = array();
178 $entry["rules"]['responsiveness'] = array();
179 $entry["rules"]['accessibility'] = array();
180
181 $rules = new Entry\ComponentEntryRules($entry["rules"]);
182 $this->assertEquals($rules->getRules(), $entry["rules"]);
183 }

Field Documentation

◆ $correct_rules1_array

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

Definition at line 38 of file ComponentEntryRulesTest.php.

◆ $correct_rules2_array

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

Definition at line 48 of file ComponentEntryRulesTest.php.

◆ $correct_rules2_array_return

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

Definition at line 52 of file ComponentEntryRulesTest.php.

◆ $empty_rules_array

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

Definition at line 12 of file ComponentEntryRulesTest.php.

◆ $invalid_categories1_array

ComponentEntryRulesTest::$invalid_categories1_array
protected
Initial value:
= array(
"usage",
"wrong"
)

Definition at line 22 of file ComponentEntryRulesTest.php.

◆ $invalid_categories2_array

ComponentEntryRulesTest::$invalid_categories2_array
protected
Initial value:
= array(
"usage"=>array(),
"wrong"=>array()
)

Definition at line 26 of file ComponentEntryRulesTest.php.

◆ $invalid_category_item_array

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

Definition at line 30 of file ComponentEntryRulesTest.php.

◆ $invalid_category_value_array

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

Definition at line 34 of file ComponentEntryRulesTest.php.

◆ $parser

ComponentEntryRulesTest::$parser
protected

Definition at line 66 of file ComponentEntryRulesTest.php.

◆ $proper_entry

ComponentEntryRulesTest::$proper_entry
protected

Definition at line 71 of file ComponentEntryRulesTest.php.


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