4 require_once(
"libs/composer/vendor/autoload.php");
5 include_once(
"tests/UI/Crawler/Fixture/Fixture.php");
15 "composition" => array(),
16 "interaction" => array(),
18 "ordering" => array(),
20 "responsiveness" => array(),
21 "accessibility" => array()
32 "usage" => array(
"Correct"),
33 "composition" =>
"Wrong" 36 "usage" => array(
"Correct"),
37 "composition" => array(array(
"wrong"))
40 "usage" => array(1 =>
"Usage Rule 1", 2 =>
"Usage Rule 2"),
41 "composition" => array(1 =>
"composition Rule 1", 2 =>
"composition Rule 2"),
42 "interaction" => array(1 =>
"interaction Rule 1", 2 =>
"interaction Rule 2"),
43 "wording" => array(1 =>
"wording Rule 1", 2 =>
"wording Rule 2"),
44 "ordering" => array(1 =>
"ordering Rule 1", 2 =>
"ordering Rule 2"),
45 "style" => array(1 =>
"style Rule 1", 2 =>
"style Rule 2"),
46 "responsiveness" => array(1 =>
"responsiveness Rule 1", 2 =>
"responsiveness Rule 2"),
47 "accessibility" => array(1 =>
"accessibility Rule 1", 2 =>
"accessibility Rule 2")
50 "usage" => array(1 =>
"Usage Rule 1", 2 =>
"Usage Rule 2"),
54 "usage" => array(1 =>
"Usage Rule 1", 2 =>
"Usage Rule 2"),
55 "composition" => array(),
56 "interaction" => array(),
58 "ordering" => array(),
60 "responsiveness" => array(),
61 "accessibility" => array()
74 protected function setUp() : void
86 $rule =
new Entry\ComponentEntryRules();
87 $this->assertEquals($this->empty_rules_array, $rule->getRules());
89 $rule =
new Entry\ComponentEntryRules(array());
90 $this->assertEquals($this->empty_rules_array, $rule->getRules());
98 $rules =
new Entry\ComponentEntryRules($this->empty_rules_array);
99 $this->assertFalse($rules->hasRules());
100 $rules =
new Entry\ComponentEntryRules($this->correct_rules1_array);
101 $this->assertTrue($rules->hasRules());
110 new Entry\ComponentEntryRules(null);
111 new Entry\ComponentEntryRules(
"rule1");
112 $this->assertFalse(
"This should not happen");
114 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::ARRAY_EXPECTED);
123 new Entry\ComponentEntryRules($this->invalid_categories1_array);
124 $this->assertFalse(
"This should not happen");
126 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::INVALID_INDEX);
135 new Entry\ComponentEntryRules($this->invalid_categories2_array);
136 $this->assertFalse(
"This should not happen");
138 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::INVALID_INDEX);
147 new Entry\ComponentEntryRules($this->invalid_category_item_array);
148 $this->assertFalse(
"This should not happen");
150 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::ARRAY_EXPECTED);
159 new Entry\ComponentEntryRules($this->invalid_category_value_array);
160 $this->assertFalse(
"This should not happen");
162 $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::STRING_EXPECTED);
170 $rules =
new Entry\ComponentEntryRules($this->correct_rules1_array);
171 $this->assertEquals($this->correct_rules1_array, $rules->getRules());
179 $rules =
new Entry\ComponentEntryRules($this->correct_rules2_array);
180 $this->assertEquals($this->correct_rules2_array_return, $rules->getRules());
185 $entry = $this->parser->parseArrayFromFile(
"tests/UI/Crawler/Fixture/ProperEntry.php")[0];
187 $entry[
"rules"][
'composition'] = array();
188 $entry[
"rules"][
'interaction'] = array();
189 $entry[
"rules"][
'wording'] = array();
190 $entry[
"rules"][
'ordering'] = array();
191 $entry[
"rules"][
'responsiveness'] = array();
192 $entry[
"rules"][
'accessibility'] = array();
194 $rules =
new Entry\ComponentEntryRules($entry[
"rules"]);
195 $this->assertEquals($rules->getRules(), $entry[
"rules"]);
$invalid_categories2_array
testInvalidCategoryValue()
$invalid_category_value_array
testInvalidCategoryItem()
testParseProperEntryToArray()
$invalid_categories1_array
$invalid_category_item_array
$correct_rules2_array_return