ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ComponentEntryDescriptionTest Class Reference
+ Inheritance diagram for ComponentEntryDescriptionTest:
+ Collaboration diagram for ComponentEntryDescriptionTest:

Public Member Functions

 testEmptyDescription ()
 
 testInvalidDescription ()
 
 testInvalidCategories1 ()
 
 testInvalidCategories2 ()
 
 testInvalidCategoryItem ()
 
 testInvalidCategoryValue ()
 
 testCorrectDescription1 ()
 
 testCorrectDescription2 ()
 
 testParseProperEntryToArray ()
 

Data Fields

array composition
 
array wrong
 
array rivals
 

Protected Member Functions

 setUp ()
 

Protected Attributes

array $empty_description_array
 
array $invalid_categories1_array
 
array $invalid_categories2_array
 
array $invalid_category_item_array
 
array $invalid_category_value_array
 
array $correct_description1_array
 
array $correct_description2_array
 
array $correct_description2_array_return
 
Crawler EntriesYamlParser $parser
 
ProperEntryFixture $proper_entry
 

Detailed Description

Definition at line 28 of file ComponentEntryDescriptionTest.php.

Member Function Documentation

◆ setUp()

ComponentEntryDescriptionTest::setUp ( )
protected

Definition at line 78 of file ComponentEntryDescriptionTest.php.

78  : void
79  {
80  $this->parser = new Crawler\EntriesYamlParser();
81  $this->proper_entry = new ProperEntryFixture();
82  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Fixture.php:19

◆ testCorrectDescription1()

ComponentEntryDescriptionTest::testCorrectDescription1 ( )
Exceptions
Crawler

Definition at line 157 of file ComponentEntryDescriptionTest.php.

157  : void
158  {
159  $description = new Entry\ComponentEntryDescription($this->correct_description1_array);
160  $this->assertEquals($this->correct_description1_array, $description->getDescription());
161  }

◆ testCorrectDescription2()

ComponentEntryDescriptionTest::testCorrectDescription2 ( )
Exceptions
Crawler

Definition at line 166 of file ComponentEntryDescriptionTest.php.

166  : void
167  {
168  $description = new Entry\ComponentEntryDescription($this->correct_description2_array);
169  $this->assertEquals($this->correct_description2_array_return, $description->getDescription());
170  }

◆ testEmptyDescription()

ComponentEntryDescriptionTest::testEmptyDescription ( )
Exceptions
Crawler

Definition at line 87 of file ComponentEntryDescriptionTest.php.

87  : void
88  {
89  $description = new Entry\ComponentEntryDescription();
90  $this->assertEquals($this->empty_description_array, $description->getDescription());
91 
92  $description = new Entry\ComponentEntryDescription(array());
93  $this->assertEquals($this->empty_description_array, $description->getDescription());
94  }

◆ testInvalidCategories1()

ComponentEntryDescriptionTest::testInvalidCategories1 ( )
Exceptions
Crawler

Definition at line 109 of file ComponentEntryDescriptionTest.php.

References Vendor\Package\$e.

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

◆ testInvalidCategories2()

ComponentEntryDescriptionTest::testInvalidCategories2 ( )
Exceptions
Crawler

Definition at line 121 of file ComponentEntryDescriptionTest.php.

References Vendor\Package\$e.

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

◆ testInvalidCategoryItem()

ComponentEntryDescriptionTest::testInvalidCategoryItem ( )
Exceptions
Crawler

Definition at line 133 of file ComponentEntryDescriptionTest.php.

References Vendor\Package\$e.

133  : void
134  {
135  try {
136  new Entry\ComponentEntryDescription($this->invalid_category_item_array);
137  $this->assertFalse("This should not happen");
139  $this->assertEquals(Crawler\Exception\CrawlerException::STRING_EXPECTED, $e->getCode());
140  }
141  }

◆ testInvalidCategoryValue()

ComponentEntryDescriptionTest::testInvalidCategoryValue ( )
Exceptions
Crawler

Definition at line 145 of file ComponentEntryDescriptionTest.php.

References Vendor\Package\$e.

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

◆ testInvalidDescription()

ComponentEntryDescriptionTest::testInvalidDescription ( )
Exceptions
Crawler

Definition at line 98 of file ComponentEntryDescriptionTest.php.

References null.

98  : void
99  {
100  $this->expectException(TypeError::class);
101  new Entry\ComponentEntryDescription(null);
102 
103  $this->expectException(TypeError::class);
104  new Entry\ComponentEntryDescription('desc1');
105  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testParseProperEntryToArray()

ComponentEntryDescriptionTest::testParseProperEntryToArray ( )

Definition at line 172 of file ComponentEntryDescriptionTest.php.

172  : void
173  {
174  $entry = $this->parser->parseArrayFromFile("components/ILIAS/UI/tests/Crawler/Fixture/ProperEntry.php")[0];
175 
176  $entry["description"]['composition'] = "";
177  $entry["description"]['effect'] = "";
178 
179  $description = new Entry\ComponentEntryDescription($entry["description"]);
180 
181  $this->assertEquals($description->getDescription(), $entry["description"]);
182  }

Field Documentation

◆ $correct_description1_array

array ComponentEntryDescriptionTest::$correct_description1_array
protected
Initial value:
= [
"purpose" => "Purpose Description"

Definition at line 57 of file ComponentEntryDescriptionTest.php.

◆ $correct_description2_array

array ComponentEntryDescriptionTest::$correct_description2_array
protected
Initial value:
= [
"purpose" => "Purpose Description"
]

Definition at line 64 of file ComponentEntryDescriptionTest.php.

◆ $correct_description2_array_return

array ComponentEntryDescriptionTest::$correct_description2_array_return
protected
Initial value:
= [
"purpose" => "Purpose Description"

Definition at line 68 of file ComponentEntryDescriptionTest.php.

◆ $empty_description_array

array ComponentEntryDescriptionTest::$empty_description_array
protected
Initial value:
= [
"purpose" => ""

Definition at line 30 of file ComponentEntryDescriptionTest.php.

◆ $invalid_categories1_array

array ComponentEntryDescriptionTest::$invalid_categories1_array
protected
Initial value:
= [
"purpose",
"wrong"
]

Definition at line 37 of file ComponentEntryDescriptionTest.php.

◆ $invalid_categories2_array

array ComponentEntryDescriptionTest::$invalid_categories2_array
protected
Initial value:
= [
"purpose" => ""

Definition at line 42 of file ComponentEntryDescriptionTest.php.

◆ $invalid_category_item_array

array ComponentEntryDescriptionTest::$invalid_category_item_array
protected
Initial value:
= [
"purpose" => "Correct"

Definition at line 47 of file ComponentEntryDescriptionTest.php.

◆ $invalid_category_value_array

array ComponentEntryDescriptionTest::$invalid_category_value_array
protected
Initial value:
= [
"purpose" => "Correct"

Definition at line 52 of file ComponentEntryDescriptionTest.php.

◆ $parser

Crawler EntriesYamlParser ComponentEntryDescriptionTest::$parser
protected

Definition at line 75 of file ComponentEntryDescriptionTest.php.

◆ $proper_entry

ProperEntryFixture ComponentEntryDescriptionTest::$proper_entry
protected

Definition at line 76 of file ComponentEntryDescriptionTest.php.

◆ composition

array ComponentEntryDescriptionTest::composition
Initial value:
=> "",
"effect" => "",
"rivals" => []
]

Definition at line 32 of file ComponentEntryDescriptionTest.php.

◆ rivals

array ComponentEntryDescriptionTest::rivals
Initial value:
=> [["wrong"]]
]

Definition at line 54 of file ComponentEntryDescriptionTest.php.

◆ wrong

array ComponentEntryDescriptionTest::wrong
Initial value:
=> ""
]

Definition at line 44 of file ComponentEntryDescriptionTest.php.


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