ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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)
 
 testGetRecursion (TestingTree $tree)
 
 testWithEnvironment (TestingTree $tree)
 
 testWithData (TestingTree $tree)
 
 testWithHighlightOnNodeClick (TestingTree $tree)
 
 testWithIsSubTree (TestingTree $tree)
 

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.

References ILIAS\UI\Implementation\Component\Tree\Tree\$environment, ILIAS\UI\Implementation\Component\Tree\Tree\$label, ILIAS\UI\Implementation\Component\Tree\Tree\$recursion, and null.

53  : TestingTree
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(
63  Factory $factory,
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  }
This describes a Tree Node.
Definition: Node.php:30
Dummy-implementation for testing.
Definition: TreeTest.php:32
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Interface for mapping data-structures to the Tree.

◆ testGetLabel()

TreeTest::testGetLabel ( TestingTree  $tree)

Definition at line 77 of file TreeTest.php.

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

77  : void
78  {
79  $this->assertEquals("label", $tree->getLabel());
80  }
+ Here is the call graph for this function:

◆ testGetRecursion()

TreeTest::testGetRecursion ( TestingTree  $tree)

Definition at line 83 of file TreeTest.php.

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

83  : void
84  {
85  $this->assertInstanceOf("ILIAS\\UI\\Component\\Tree\\TreeRecursion", $tree->getRecursion());
86  }
getRecursion()
Get the mapping-class.
Definition: Tree.php:102
+ Here is the call graph for this function:

◆ testWithData()

TreeTest::testWithData ( TestingTree  $tree)

Definition at line 96 of file TreeTest.php.

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

96  : void
97  {
98  $data = ['entry1', 'entry2'];
99  $this->assertEquals($data, $tree->withData($data)->getData());
100  }
withData($data)
Apply data to the Tree.
Definition: Tree.php:76
+ Here is the call graph for this function:

◆ testWithEnvironment()

TreeTest::testWithEnvironment ( TestingTree  $tree)

Definition at line 89 of file TreeTest.php.

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

89  : void
90  {
91  $env = ['key1' => 'val1', 'key2' => 2];
92  $this->assertEquals($env, $tree->withEnvironment($env)->getEnvironment());
93  }
withEnvironment($environment)
Configure the Tree with additional information that will be relayed to TreeRecursion.
Definition: Tree.php:66
+ Here is the call graph for this function:

◆ testWithHighlightOnNodeClick()

TreeTest::testWithHighlightOnNodeClick ( TestingTree  $tree)

Definition at line 103 of file TreeTest.php.

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

103  : void
104  {
105  $this->assertFalse($tree->getHighlightOnNodeClick());
106  $this->assertTrue($tree->withHighlightOnNodeClick(true)->getHighlightOnNodeClick());
107  }
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
+ Here is the call graph for this function:

◆ testWithIsSubTree()

TreeTest::testWithIsSubTree ( TestingTree  $tree)

Definition at line 110 of file TreeTest.php.

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

110  : void
111  {
112  $this->assertFalse($tree->isSubTree());
113  $this->assertTrue($tree->withIsSubTree(true)->isSubTree());
114  }
isSubTree()
Is this only a part of a tree? Needed if parts are loaded async.
Definition: Tree.php:128
withIsSubTree(bool $is_sub)
Set this tree to be a part of a tree.Needed if parts are loaded async.
Definition: Tree.php:136
+ 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  }
Dummy-implementation for testing.
Definition: TreeTest.php:32

◆ 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  }
Dummy-implementation for testing.
Definition: TreeTest.php:32

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