ILIAS  release_8 Revision v8.24
DrilldownTest Class Reference

Tests for the Drilldown. More...

+ Inheritance diagram for DrilldownTest:
+ Collaboration diagram for DrilldownTest:

Public Member Functions

 getUIFactory ()
 
 setUp ()
 
 testConstruction ()
 
 testGetLabel (C\Menu\Drilldown $menu)
 @depends testConstruction More...
 
 testGetItems ($menu)
 @depends testConstruction More...
 
 testWithEntries ()
 
 testWithWrongEntry ()
 
 testRendering ()
 @depends testWithEntries More...
 
 testWithPersistenceId ($menu)
 @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)
 

Protected Attributes

C Symbol Icon Standard $icon
 
C Symbol Glyph Glyph $glyph
 
C Button Standard $button
 
C Divider Horizontal $divider
 
C Legacy Legacy $legacy
 

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 Drilldown.

Definition at line 31 of file DrilldownTest.php.

Member Function Documentation

◆ getUIFactory()

DrilldownTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 39 of file DrilldownTest.php.

40 {
41 return new class () extends NoUIFactory {
42 public function menu(): C\Menu\Factory
43 {
44 return new Menu\Factory(
45 new I\SignalGenerator()
46 );
47 }
48 public function button(): C\Button\Factory
49 {
50 return new I\Button\Factory();
51 }
52 public function legacy(string $content): C\Legacy\Legacy
53 {
54 return new I\Legacy\Legacy(
55 $content,
56 new I\SignalGenerator()
57 );
58 }
59 public function symbol(): \ILIAS\UI\Component\Symbol\Factory
60 {
61 return new I\Symbol\Factory(
62 new I\Symbol\Icon\Factory(),
63 new I\Symbol\Glyph\Factory(),
64 new I\Symbol\Avatar\Factory()
65 );
66 }
67 };
68 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

References ILIAS\UI\examples\MainControls\Slate\Legacy\legacy().

Referenced by setUp(), testConstruction(), testRendering(), testWithEntries(), and testWithWrongEntry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

DrilldownTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 70 of file DrilldownTest.php.

70 : void
71 {
72 $icon_factory = new I\Symbol\Icon\Factory();
73 $glyph_factory = new I\Symbol\Glyph\Factory();
74 $button_factory = new I\Button\Factory();
75 $divider_factory = new I\Divider\Factory();
76 $this->icon = $icon_factory->standard('', '');
77 $this->glyph = $glyph_factory->user('');
78 $this->button = $button_factory->standard('', '');
79 $this->divider = $divider_factory->horizontal();
80 $this->legacy = $this->getUIFactory()->legacy('');
81 }

References getUIFactory(), and ILIAS\UI\examples\MainControls\Slate\Legacy\legacy().

+ Here is the call graph for this function:

◆ testConstruction()

DrilldownTest::testConstruction ( )

Definition at line 83 of file DrilldownTest.php.

83 : C\Menu\Drilldown
84 {
85 $f = $this->getUIFactory();
86 $menu = $f->menu()->drilldown('root', []);
87 $this->assertInstanceOf(
88 "ILIAS\\UI\\Component\\Menu\\Menu",
89 $menu
90 );
91 $this->assertInstanceOf(
92 "ILIAS\\UI\\Component\\Menu\\Drilldown",
93 $menu
94 );
95
96 $menu = $f->menu()->drilldown('root', []);
97
98 return $menu;
99 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testGetItems()

DrilldownTest::testGetItems (   $menu)

@depends testConstruction

Definition at line 115 of file DrilldownTest.php.

115 : void
116 {
117 $this->assertEquals(
118 [],
119 $menu->getItems()
120 );
121 }

◆ testGetLabel()

DrilldownTest::testGetLabel ( C\Menu\Drilldown  $menu)

@depends testConstruction

Definition at line 104 of file DrilldownTest.php.

104 : void
105 {
106 $this->assertEquals(
107 'root',
108 $menu->getLabel()
109 );
110 }

◆ testRendering()

DrilldownTest::testRendering ( )

@depends testWithEntries

Definition at line 152 of file DrilldownTest.php.

152 : void
153 {
154 $r = $this->getDefaultRenderer();
155 $f = $this->getUIFactory();
156
157 $items = [
158 $f->menu()->sub('1', [
159 $f->menu()->sub('1.1', []),
160 $f->menu()->sub('1.2', []),
161 ]),
162 $f->menu()->sub('2', [])
163 ];
164 $menu = $f->menu()->drilldown('root', $items);
165
166 $html = $r->render($menu);
167 $expected = file_get_contents(__DIR__ . "/drilldown_test.html");
168
169 $this->assertEquals(
170 $this->brutallyTrimHTML($expected),
171 $this->brutallyTrimHTML($html)
172 );
173 }
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 Vendor\Package\$f, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getUIFactory().

+ Here is the call graph for this function:

◆ testWithEntries()

DrilldownTest::testWithEntries ( )

Definition at line 123 of file DrilldownTest.php.

123 : C\Menu\Drilldown
124 {
125 $f = $this->getUIFactory();
126 $items = array(
127 $f->menu()->sub('sub', [
128 $this->button,
129 $this->glyph
130 ]),
131 $this->divider,
132 $this->button
133 );
134 $menu = $f->menu()->drilldown('root', $items);
135 $this->assertEquals(
136 $items,
137 $menu->getItems()
138 );
139 return $menu;
140 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testWithPersistenceId()

DrilldownTest::testWithPersistenceId (   $menu)

@depends testConstruction

Definition at line 178 of file DrilldownTest.php.

178 : void
179 {
180 $this->assertNull($menu->getPersistenceId()) ;
181
182 $id = "some_id";
183 $this->assertEquals(
184 $id,
185 $menu->withPersistenceId($id)->getPersistenceId()
186 );
187 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ testWithWrongEntry()

DrilldownTest::testWithWrongEntry ( )

Definition at line 142 of file DrilldownTest.php.

142 : void
143 {
144 $this->expectException(InvalidArgumentException::class);
145 $f = $this->getUIFactory();
146 $f->menu()->drilldown('label', [$this->legacy]);
147 }

References Vendor\Package\$f, getUIFactory(), and ILIAS\UI\examples\MainControls\Slate\Legacy\legacy().

+ Here is the call graph for this function:

Field Documentation

◆ $button

C Button Standard DrilldownTest::$button
protected

Definition at line 35 of file DrilldownTest.php.

◆ $divider

C Divider Horizontal DrilldownTest::$divider
protected

Definition at line 36 of file DrilldownTest.php.

◆ $glyph

C Symbol Glyph Glyph DrilldownTest::$glyph
protected

Definition at line 34 of file DrilldownTest.php.

◆ $icon

C Symbol Icon Standard DrilldownTest::$icon
protected

Definition at line 33 of file DrilldownTest.php.

◆ $legacy

C Legacy Legacy DrilldownTest::$legacy
protected

Definition at line 37 of file DrilldownTest.php.


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