ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 11 of file ComponentEntryRulesTest.php.

Member Function Documentation

◆ setUp()

ComponentEntryRulesTest::setUp ( )
protected

Definition at line 74 of file ComponentEntryRulesTest.php.

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

◆ testCorrectRules1()

ComponentEntryRulesTest::testCorrectRules1 ( )
Exceptions
Crawler

Definition at line 155 of file ComponentEntryRulesTest.php.

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

◆ testCorrectRules2()

ComponentEntryRulesTest::testCorrectRules2 ( )
Exceptions
Crawler

Definition at line 164 of file ComponentEntryRulesTest.php.

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

◆ testEmptyRules()

ComponentEntryRulesTest::testEmptyRules ( )
Exceptions
Crawler

Definition at line 84 of file ComponentEntryRulesTest.php.

References array.

84  {
85  $rule = new Entry\ComponentEntryRules();
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  }
Create styles array
The data for the language used.

◆ testInvalidCategories1()

ComponentEntryRulesTest::testInvalidCategories1 ( )
Exceptions
Crawler

Definition at line 107 of file ComponentEntryRulesTest.php.

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

◆ testInvalidCategories2()

ComponentEntryRulesTest::testInvalidCategories2 ( )
Exceptions
Crawler

Definition at line 119 of file ComponentEntryRulesTest.php.

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

◆ testInvalidCategoryItem()

ComponentEntryRulesTest::testInvalidCategoryItem ( )
Exceptions
Crawler

Definition at line 131 of file ComponentEntryRulesTest.php.

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

◆ testInvalidCategoryValue()

ComponentEntryRulesTest::testInvalidCategoryValue ( )
Exceptions
Crawler

Definition at line 143 of file ComponentEntryRulesTest.php.

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

◆ testInvalidRules()

ComponentEntryRulesTest::testInvalidRules ( )
Exceptions
Crawler

Definition at line 94 of file ComponentEntryRulesTest.php.

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

◆ testParseProperEntryToArray()

ComponentEntryRulesTest::testParseProperEntryToArray ( )

Definition at line 170 of file ComponentEntryRulesTest.php.

References array.

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

Field Documentation

◆ $correct_rules1_array

ComponentEntryRulesTest::$correct_rules1_array
protected
Initial value:
"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:
"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:
"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:
"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:
"usage",
"wrong"
)

Definition at line 23 of file ComponentEntryRulesTest.php.

◆ $invalid_categories2_array

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

Definition at line 27 of file ComponentEntryRulesTest.php.

◆ $invalid_category_item_array

ComponentEntryRulesTest::$invalid_category_item_array
protected
Initial value:
"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:
"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: