ILIAS  release_8 Revision v8.24
TreeTest Class Reference

Tests for the (Base-)Tree. More...

+ Inheritance diagram for TreeTest:
+ Collaboration diagram for TreeTest:

Public Member Functions

 testWrongConstruction ()
 
 testWrongTypeConstruction ()
 
 testConstruction ()
 
 testGetLabel (TestingTree $tree)
 @depends testConstruction More...
 
 testGetRecursion (TestingTree $tree)
 @depends testConstruction More...
 
 testWithEnvironment (TestingTree $tree)
 @depends testConstruction More...
 
 testWithData (TestingTree $tree)
 @depends testConstruction More...
 
 testWithHighlightOnNodeClick (TestingTree $tree)
 @depends testConstruction More...
 
 testWithIsSubTree (TestingTree $tree)
 @depends testConstruction More...
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Tests for the (Base-)Tree.

Definition at line 39 of file TreeTest.php.

Member Function Documentation

◆ testConstruction()

TreeTest::testConstruction ( )

Definition at line 53 of file TreeTest.php.

54 {
55 $label = "label";
56 $recursion = new class () implements TreeRecursion {
57 public function getChildren($record, $environment = null): array
58 {
59 return [];
60 }
61
62 public function build(
64 $record,
65 $environment = null
66 ): Node {
67 }
68 };
69
70 $tree = new TestingTree($label, $recursion);
71 $this->assertInstanceOf("ILIAS\\UI\\Component\\Tree\\Tree", $tree);
72
73 return $tree;
74 }
Dummy-implementation for testing.
Definition: TreeTest.php:33
This describes a Tree Node.
Definition: Node.php:31
Interface for mapping data-structures to the Tree.
$factory
Definition: metadata.php:75

References $factory.

◆ testGetLabel()

TreeTest::testGetLabel ( TestingTree  $tree)

@depends testConstruction

Definition at line 79 of file TreeTest.php.

79 : void
80 {
81 $this->assertEquals("label", $tree->getLabel());
82 }

References ILIAS\UI\Implementation\Component\Tree\Tree\getLabel().

+ Here is the call graph for this function:

◆ testGetRecursion()

TreeTest::testGetRecursion ( TestingTree  $tree)

@depends testConstruction

Definition at line 87 of file TreeTest.php.

87 : void
88 {
89 $this->assertInstanceOf("ILIAS\\UI\\Component\\Tree\\TreeRecursion", $tree->getRecursion());
90 }
getRecursion()
Get the mapping-class.
Definition: Tree.php:102

References ILIAS\UI\Implementation\Component\Tree\Tree\getRecursion().

+ Here is the call graph for this function:

◆ testWithData()

TreeTest::testWithData ( TestingTree  $tree)

@depends testConstruction

Definition at line 104 of file TreeTest.php.

104 : void
105 {
106 $data = ['entry1', 'entry2'];
107 $this->assertEquals($data, $tree->withData($data)->getData());
108 }
withData($data)
Apply data to the Tree.
Definition: Tree.php:76

References $data, and ILIAS\UI\Implementation\Component\Tree\Tree\withData().

+ Here is the call graph for this function:

◆ testWithEnvironment()

TreeTest::testWithEnvironment ( TestingTree  $tree)

@depends testConstruction

Definition at line 95 of file TreeTest.php.

95 : void
96 {
97 $env = ['key1' => 'val1', 'key2' => 2];
98 $this->assertEquals($env, $tree->withEnvironment($env)->getEnvironment());
99 }
withEnvironment($environment)
Configure the Tree with additional information that will be relayed to TreeRecursion.
Definition: Tree.php:66

References ILIAS\UI\Implementation\Component\Tree\Tree\withEnvironment().

+ Here is the call graph for this function:

◆ testWithHighlightOnNodeClick()

TreeTest::testWithHighlightOnNodeClick ( TestingTree  $tree)

@depends testConstruction

Definition at line 113 of file TreeTest.php.

113 : void
114 {
115 $this->assertFalse($tree->getHighlightOnNodeClick());
116 $this->assertTrue($tree->withHighlightOnNodeClick(true)->getHighlightOnNodeClick());
117 }
withHighlightOnNodeClick(bool $highlight_nodes_on_click)
Should a clicked node be highlighted?
Definition: Tree.php:110
getHighlightOnNodeClick()
Is the tree configured to highlight a clicked node?
Definition: Tree.php:120

References ILIAS\UI\Implementation\Component\Tree\Tree\getHighlightOnNodeClick(), and ILIAS\UI\Implementation\Component\Tree\Tree\withHighlightOnNodeClick().

+ Here is the call graph for this function:

◆ testWithIsSubTree()

TreeTest::testWithIsSubTree ( TestingTree  $tree)

@depends testConstruction

Definition at line 122 of file TreeTest.php.

122 : void
123 {
124 $this->assertFalse($tree->isSubTree());
125 $this->assertTrue($tree->withIsSubTree(true)->isSubTree());
126 }
withIsSubTree(bool $is_sub)
Set this tree to be a part of a tree.Needed if parts are loaded async.
Definition: Tree.php:136
isSubTree()
Is this only a part of a tree? Needed if parts are loaded async.
Definition: Tree.php:128

References ILIAS\UI\Implementation\Component\Tree\Tree\isSubTree(), and ILIAS\UI\Implementation\Component\Tree\Tree\withIsSubTree().

+ Here is the call graph for this function:

◆ testWrongConstruction()

TreeTest::testWrongConstruction ( )

Definition at line 41 of file TreeTest.php.

41 : void
42 {
43 $this->expectException(ArgumentCountError::class);
44 $tree = new TestingTree();
45 }

◆ testWrongTypeConstruction()

TreeTest::testWrongTypeConstruction ( )

Definition at line 47 of file TreeTest.php.

47 : void
48 {
49 $this->expectException(TypeError::class);
50 $tree = new TestingTree('something');
51 }

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