ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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

 $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.

74  {
75  $this->parser = new Crawler\EntriesYamlParser();
76  $this->proper_entry = new ProperEntryFixture();
77  }

◆ testCorrectRules1()

ComponentEntryRulesTest::testCorrectRules1 ( )
Exceptions
Crawler

Definition at line 167 of file ComponentEntryRulesTest.php.

168  {
169  $rules = new Entry\ComponentEntryRules($this->correct_rules1_array);
170  $this->assertEquals($this->correct_rules1_array, $rules->getRules());
171  }

◆ testCorrectRules2()

ComponentEntryRulesTest::testCorrectRules2 ( )
Exceptions
Crawler

Definition at line 176 of file ComponentEntryRulesTest.php.

177  {
178  $rules = new Entry\ComponentEntryRules($this->correct_rules2_array);
179  $this->assertEquals($this->correct_rules2_array_return, $rules->getRules());
180  }

◆ testEmptyRules()

ComponentEntryRulesTest::testEmptyRules ( )
Exceptions
Crawler

Definition at line 83 of file ComponentEntryRulesTest.php.

References $rule.

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

◆ testHasRules()

ComponentEntryRulesTest::testHasRules ( )
Exceptions
Crawler

Definition at line 95 of file ComponentEntryRulesTest.php.

96  {
97  $rules = new Entry\ComponentEntryRules($this->empty_rules_array);
98  $this->assertFalse($rules->hasRules());
99  $rules = new Entry\ComponentEntryRules($this->correct_rules1_array);
100  $this->assertTrue($rules->hasRules());
101  }

◆ testInvalidCategories1()

ComponentEntryRulesTest::testInvalidCategories1 ( )
Exceptions
Crawler

Definition at line 119 of file ComponentEntryRulesTest.php.

120  {
121  try {
122  new Entry\ComponentEntryRules($this->invalid_categories1_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  }

◆ testInvalidCategories2()

ComponentEntryRulesTest::testInvalidCategories2 ( )
Exceptions
Crawler

Definition at line 131 of file ComponentEntryRulesTest.php.

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

◆ testInvalidCategoryItem()

ComponentEntryRulesTest::testInvalidCategoryItem ( )
Exceptions
Crawler

Definition at line 143 of file ComponentEntryRulesTest.php.

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

◆ testInvalidCategoryValue()

ComponentEntryRulesTest::testInvalidCategoryValue ( )
Exceptions
Crawler

Definition at line 155 of file ComponentEntryRulesTest.php.

156  {
157  try {
158  new Entry\ComponentEntryRules($this->invalid_category_value_array);
159  $this->assertFalse("This should not happen");
160  } catch (Crawler\Exception\CrawlerException $e) {
161  $this->assertEquals($e->getCode(), Crawler\Exception\CrawlerException::STRING_EXPECTED);
162  }
163  }

◆ testInvalidRules()

ComponentEntryRulesTest::testInvalidRules ( )
Exceptions
Crawler

Definition at line 106 of file ComponentEntryRulesTest.php.

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

◆ testParseProperEntryToArray()

ComponentEntryRulesTest::testParseProperEntryToArray ( )

Definition at line 182 of file ComponentEntryRulesTest.php.

183  {
184  $entry = $this->parser->parseArrayFromFile("tests/UI/Crawler/Fixture/ProperEntry.php")[0];
185 
186  $entry["rules"]['composition'] = array();
187  $entry["rules"]['interaction'] = array();
188  $entry["rules"]['wording'] = array();
189  $entry["rules"]['ordering'] = array();
190  $entry["rules"]['responsiveness'] = array();
191  $entry["rules"]['accessibility'] = array();
192 
193  $rules = new Entry\ComponentEntryRules($entry["rules"]);
194  $this->assertEquals($rules->getRules(), $entry["rules"]);
195  }

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: