19declare(strict_types=1);
21require_once(
'vendor/composer/vendor/autoload.php');
22include_once(
'./components/ILIAS/UI/tests/UITestHelper.php');
24use PHPUnit\Framework\TestCase;
39 protected function setUp(): void
43 $this->entries_data = include
'./components/ILIAS/UI/tests/Crawler/Fixture/EntriesFixture.php';
44 $this->entries =
new Entries();
45 $this->entries->addEntriesFromArray($this->entries_data);
46 $this->test_uri =
new URI(
'http://ilias.de');
52 $this->assertInstanceOf(
'KSDocumentationTreeRecursion', $this->tree_recursion);
58 [$this->entries->getEntryById(
'Entry2')],
59 $this->tree_recursion->getChildren($this->entries->getEntryById(
'Entry1'))
61 $this->assertEquals([], $this->tree_recursion->getChildren($this->entries->getEntryById(
'Entry2')));
66 $tree_factory = $this->ui_helper->factory()->tree()->node();
67 $built_node = $this->tree_recursion->build($tree_factory, $this->entries->getEntryById(
'Entry1'));
68 $this->assertInstanceOf(
'ILIAS\UI\Implementation\Component\Tree\Node\Simple', $built_node);
73 $tree_factory = $this->ui_helper->factory()->tree()->node();
74 $built_root_node = $this->tree_recursion->build($tree_factory, $this->entries->getEntryById(
'Entry1'));
75 $built_child_node = $this->tree_recursion->build($tree_factory, $this->entries->getEntryById(
'Entry2'));
77 $this->assertEquals(
true, $built_root_node->isExpanded());
78 $this->assertEquals(
false, $built_child_node->isExpanded());
85 $tree_factory = $this->ui_helper->factory()->tree()->node();
86 $built_root_node = $this->tree_recursion->build($tree_factory, $this->entries->getEntryById(
'Entry1'));
87 $built_child_node = $this->tree_recursion->build($tree_factory, $this->entries->getEntryById(
'Entry2'));
89 $this->assertEquals(
false, $built_root_node->isHighlighted());
90 $this->assertEquals(
true, $built_child_node->isHighlighted());
97 $tree_factory = $this->ui_helper->factory()->tree()->node();
98 $built_root_node = $this->tree_recursion->build($tree_factory, $this->entries->getEntryById(
'Entry1'));
99 $built_child_node = $this->tree_recursion->build($tree_factory, $this->entries->getEntryById(
'Entry2'));
101 $this->assertEquals(
true, $built_root_node->isExpanded());
102 $this->assertEquals(
false, $built_child_node->isExpanded());
109 $tree_factory = $this->ui_helper->factory()->tree()->node();
110 $built_root_node = $this->tree_recursion->build($tree_factory, $this->entries->getEntryById(
'Entry1'));
111 $built_child_node = $this->tree_recursion->build($tree_factory, $this->entries->getEntryById(
'Entry2'));
113 $this->assertEquals(
false, $built_root_node->isHighlighted());
114 $this->assertEquals(
true, $built_child_node->isHighlighted());
trait UITestHelper
Class UITestHelper can be helpful for test cases outside the UI Components, to inject a working facto...
The scope of this class is split ilias-conform URI's into components.
Container storing a list of UI Component Entries, can act as Iterator, countable and is serializable.
Stores Information of UI Components parsed from YAML, examples and less files.
testIsNodeHighlightedAfterActivatingEntry()
testIsNodeExpandedByDefault()
testIsNodeHighlightedByDefault()
testIsNodeExpandedAfterActivatingEntry2()
KSDocumentationTreeRecursion $tree_recursion
Tree Recursion, putting Entries into a Tree.