ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 11 of file ComponentEntryRulesTest.php.

Member Function Documentation

◆ setUp()

ComponentEntryRulesTest::setUp ( )
protected

Definition at line 74 of file ComponentEntryRulesTest.php.

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

◆ testCorrectRules1()

ComponentEntryRulesTest::testCorrectRules1 ( )
Exceptions
Crawler

Definition at line 168 of file ComponentEntryRulesTest.php.

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

◆ testCorrectRules2()

ComponentEntryRulesTest::testCorrectRules2 ( )
Exceptions
Crawler

Definition at line 177 of file ComponentEntryRulesTest.php.

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

◆ testEmptyRules()

ComponentEntryRulesTest::testEmptyRules ( )
Exceptions
Crawler

Definition at line 84 of file ComponentEntryRulesTest.php.

85  {
86  $rule = new Entry\ComponentEntryRules();
87  $this->assertEquals($this->empty_rules_array, $rule->getRules());
88 
89  $rule = new Entry\ComponentEntryRules(array());
90  $this->assertEquals($this->empty_rules_array, $rule->getRules());
91  }

◆ testHasRules()

ComponentEntryRulesTest::testHasRules ( )
Exceptions
Crawler

Definition at line 96 of file ComponentEntryRulesTest.php.

97  {
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());
102  }

◆ testInvalidCategories1()

ComponentEntryRulesTest::testInvalidCategories1 ( )
Exceptions
Crawler

Definition at line 120 of file ComponentEntryRulesTest.php.

References Vendor\Package\$e.

121  {
122  try {
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);
127  }
128  }

◆ testInvalidCategories2()

ComponentEntryRulesTest::testInvalidCategories2 ( )
Exceptions
Crawler

Definition at line 132 of file ComponentEntryRulesTest.php.

References Vendor\Package\$e.

133  {
134  try {
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);
139  }
140  }

◆ testInvalidCategoryItem()

ComponentEntryRulesTest::testInvalidCategoryItem ( )
Exceptions
Crawler

Definition at line 144 of file ComponentEntryRulesTest.php.

References Vendor\Package\$e.

145  {
146  try {
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);
151  }
152  }

◆ testInvalidCategoryValue()

ComponentEntryRulesTest::testInvalidCategoryValue ( )
Exceptions
Crawler

Definition at line 156 of file ComponentEntryRulesTest.php.

References Vendor\Package\$e.

157  {
158  try {
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);
163  }
164  }

◆ testInvalidRules()

ComponentEntryRulesTest::testInvalidRules ( )
Exceptions
Crawler

Definition at line 107 of file ComponentEntryRulesTest.php.

References Vendor\Package\$e.

108  {
109  try {
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);
115  }
116  }

◆ testParseProperEntryToArray()

ComponentEntryRulesTest::testParseProperEntryToArray ( )

Definition at line 183 of file ComponentEntryRulesTest.php.

184  {
185  $entry = $this->parser->parseArrayFromFile("tests/UI/Crawler/Fixture/ProperEntry.php")[0];
186 
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();
193 
194  $rules = new Entry\ComponentEntryRules($entry["rules"]);
195  $this->assertEquals($rules->getRules(), $entry["rules"]);
196  }

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 39 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 49 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 53 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 13 of file ComponentEntryRulesTest.php.

◆ $invalid_categories1_array

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

Definition at line 23 of file ComponentEntryRulesTest.php.

◆ $invalid_categories2_array

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

Definition at line 27 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 31 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 35 of file ComponentEntryRulesTest.php.

◆ $parser

ComponentEntryRulesTest::$parser
protected

Definition at line 67 of file ComponentEntryRulesTest.php.

◆ $proper_entry

ComponentEntryRulesTest::$proper_entry
protected

Definition at line 72 of file ComponentEntryRulesTest.php.


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