ILIAS  release_8 Revision v8.24
BylineNodeTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for BylineNodeTest:
+ Collaboration diagram for BylineNodeTest:

Public Member Functions

 setUp ()
 
 testCreateBylineNode ()
 
 testRendering ()
 
 testRenderingWithIcon ()
 
 testRenderingWithAsync ()
 
 testRenderingExpanded ()
 
- 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)
 

Private Attributes

I Tree Node Factory $node_factory
 
C Symbol Icon Standard $icon
 

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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Tests for the SimpleNode.

Definition at line 30 of file BylineNodeTest.php.

Member Function Documentation

◆ setUp()

BylineNodeTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 35 of file BylineNodeTest.php.

35 : void
36 {
37 $this->node_factory = new I\Tree\Node\Factory();
38 $icon_factory = new I\Symbol\Icon\Factory();
39 $this->icon = $icon_factory->standard("", '');
40 }

◆ testCreateBylineNode()

BylineNodeTest::testCreateBylineNode ( )

Definition at line 42 of file BylineNodeTest.php.

42 : void
43 {
44 $node = $this->node_factory->bylined('My Label', 'This is my byline', $this->icon);
45 $this->assertEquals('My Label', $node->getLabel());
46 $this->assertEquals('This is my byline', $node->getByline());
47 $this->assertEquals($this->icon, $node->getIcon());
48 }

◆ testRendering()

BylineNodeTest::testRendering ( )

Definition at line 50 of file BylineNodeTest.php.

50 : void
51 {
52 $node = $this->node_factory->bylined('My Label', 'This is my byline');
53
54 $r = $this->getDefaultRenderer();
55 $html = $r->render($node);
56
57 $expected = <<<EOT
58 <li id="" class="il-tree-node node-simple" role="treeitem">
59 <span class="node-line">
60 <span class="node-label">My Label</span>
61 <span class="node-byline">This is my byline</span>
62 </span>
63 </li>
64EOT;
65
66 $this->assertEquals(
67 $this->brutallyTrimHTML($expected),
68 $this->brutallyTrimHTML($html)
69 );
70 }
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355

References ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingExpanded()

BylineNodeTest::testRenderingExpanded ( )

Definition at line 124 of file BylineNodeTest.php.

124 : void
125 {
126 $node = $this->node_factory->bylined('My Label', 'This is my byline');
127 $node = $node->withAsyncURL('something.de')->withExpanded(true);
128
129 $r = $this->getDefaultRenderer();
130 $html = $r->render($node);
131
132 $expected = <<<EOT
133 <li id=""
134 class="il-tree-node node-simple expandable"
135 role="treeitem" aria-expanded="true"
136 data-async_url="something.de" data-async_loaded="false">
137 <span class="node-line">
138 <span class="node-label">My Label</span>
139 <span class="node-byline">This is my byline</span>
140 </span>
141 <ul role="group"></ul>
142 </li>
143EOT;
144
145 $this->assertEquals(
146 $this->brutallyTrimHTML($expected),
147 $this->brutallyTrimHTML($html)
148 );
149 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingWithAsync()

BylineNodeTest::testRenderingWithAsync ( )

Definition at line 97 of file BylineNodeTest.php.

97 : void
98 {
99 $node = $this->node_factory->bylined('My Label', 'This is my byline');
100 $node = $node->withAsyncURL('something.de');
101
102 $r = $this->getDefaultRenderer();
103 $html = $r->render($node);
104
105 $expected = <<<EOT
106 <li id=""
107 class="il-tree-node node-simple expandable"
108 role="treeitem" aria-expanded="false"
109 data-async_url="something.de" data-async_loaded="false">
110 <span class="node-line">
111 <span class="node-label">My Label</span>
112 <span class="node-byline">This is my byline</span>
113 </span>
114 <ul role="group"></ul>
115 </li>
116EOT;
117
118 $this->assertEquals(
119 $this->brutallyTrimHTML($expected),
120 $this->brutallyTrimHTML($html)
121 );
122 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingWithIcon()

BylineNodeTest::testRenderingWithIcon ( )

Definition at line 72 of file BylineNodeTest.php.

72 : void
73 {
74 $node = $this->node_factory->bylined('My Label', 'This is my byline', $this->icon);
75
76 $r = $this->getDefaultRenderer();
77 $html = $r->render($node);
78
79 $expected = <<<EOT
80 <li id="" class="il-tree-node node-simple" role="treeitem">
81 <span class="node-line">
82 <span class="node-label">
83 <img class="icon small" src="./templates/default/images/icon_default.svg" alt=""/>
84 My Label
85 </span>
86 <span class="node-byline">This is my byline</span>
87 </span>
88 </li>
89EOT;
90
91 $this->assertEquals(
92 $this->brutallyTrimHTML($expected),
93 $this->brutallyTrimHTML($html)
94 );
95 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

Field Documentation

◆ $icon

C Symbol Icon Standard BylineNodeTest::$icon
private

Definition at line 33 of file BylineNodeTest.php.

◆ $node_factory

I Tree Node Factory BylineNodeTest::$node_factory
private

Definition at line 32 of file BylineNodeTest.php.


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