ILIAS  release_7 Revision v7.30-3-g800a261c036
TreeTest Class Reference

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

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

Public Member Functions

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

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Tests for the (Base-)Tree.

Definition at line 20 of file TreeTest.php.

Member Function Documentation

◆ testConstruction()

TreeTest::testConstruction ( )

Definition at line 34 of file TreeTest.php.

35 {
36 $label = "label";
37 $recursion = new class implements \ILIAS\UI\Component\Tree\TreeRecursion {
38 public function getChildren($record, $environment = null) : array
39 {
40 return [];
41 }
42
43 public function build(
44 \ILIAS\UI\Component\Tree\Node\Factory $factory,
45 $record,
46 $environment = null
47 ) : \ILIAS\UI\Component\Tree\Node\Node {
48 }
49 };
50
51 $tree = new TestingTree($label, $recursion);
52 $this->assertInstanceOf(
53 "ILIAS\\UI\\Component\\Tree\\Tree",
54 $tree
55 );
56
57 return $tree;
58 }
Dummy-implementation for testing.
Definition: TreeTest.php:14
$factory
Definition: metadata.php:58
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

References $factory.

◆ testGetLabel()

TreeTest::testGetLabel (   $tree)

@depends testConstruction

Definition at line 63 of file TreeTest.php.

64 {
65 $this->assertEquals(
66 "label",
67 $tree->getLabel()
68 );
69 }

◆ testGetRecursion()

TreeTest::testGetRecursion (   $tree)

@depends testConstruction

Definition at line 74 of file TreeTest.php.

75 {
76 $env = ['key1' => 'val1', 'key2' => 2];
77 $this->assertInstanceOf(
78 "ILIAS\\UI\\Component\\Tree\\TreeRecursion",
79 $tree->getRecursion()
80 );
81 }

◆ testWithData()

TreeTest::testWithData (   $tree)

@depends testConstruction

Definition at line 98 of file TreeTest.php.

99 {
100 $data = ['entry1', 'entry2'];
101 $this->assertEquals(
102 $data,
103 $tree->withData($data)->getData()
104 );
105 }
$data
Definition: storeScorm.php:23

References $data.

◆ testWithEnvironment()

TreeTest::testWithEnvironment (   $tree)

@depends testConstruction

Definition at line 86 of file TreeTest.php.

87 {
88 $env = ['key1' => 'val1', 'key2' => 2];
89 $this->assertEquals(
90 $env,
91 $tree->withEnvironment($env)->getEnvironment()
92 );
93 }

◆ testWithHighlightOnNodeClick()

TreeTest::testWithHighlightOnNodeClick (   $tree)

@depends testConstruction

Definition at line 110 of file TreeTest.php.

111 {
112 $this->assertFalse(
113 $tree->getHighlightOnNodeClick()
114 );
115 $this->assertTrue(
116 $tree->withHighlightOnNodeClick(true)->getHighlightOnNodeClick()
117 );
118 }

◆ testWithIsSubTree()

TreeTest::testWithIsSubTree (   $tree)

@depends testConstruction

Definition at line 123 of file TreeTest.php.

124 {
125 $this->assertFalse(
126 $tree->isSubTree()
127 );
128 $this->assertTrue(
129 $tree->withIsSubTree(true)->isSubTree()
130 );
131 }

◆ testWrongConstruction()

TreeTest::testWrongConstruction ( )

Definition at line 22 of file TreeTest.php.

23 {
24 $this->expectException(\ArgumentCountError::class);
25 $tree = new TestingTree();
26 }

◆ testWrongTypeConstruction()

TreeTest::testWrongTypeConstruction ( )

Definition at line 28 of file TreeTest.php.

29 {
30 $this->expectException(\TypeError::class);
31 $tree = new TestingTree('something');
32 }

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