ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 
 testGetItems ($menu)
 
 testWithEntries ()
 
 testWithWrongEntry ()
 
 testRendering ()
 
 testWithPersistenceId ($menu)
 

Protected Attributes

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

Detailed Description

Tests for the Drilldown.

Definition at line 31 of file DrilldownTest.php.

Member Function Documentation

◆ getUIFactory()

DrilldownTest::getUIFactory ( )

Definition at line 39 of file DrilldownTest.php.

40 {
41 return new class () extends NoUIFactory {
42 public function menu(): I\Menu\Factory
43 {
44 return new Menu\Factory(
45 new I\SignalGenerator(),
46 );
47 }
48 public function button(): I\Button\Factory
49 {
50 return new I\Button\Factory();
51 }
52 public function legacy(): I\Legacy\Factory
53 {
54 return new I\Legacy\Factory(new I\SignalGenerator());
55 }
56 public function symbol(): I\Symbol\Factory
57 {
58 return new I\Symbol\Factory(
59 new I\Symbol\Icon\Factory(),
60 new I\Symbol\Glyph\Factory(),
61 new I\Symbol\Avatar\Factory()
62 );
63 }
64 };
65 }
This is what a factory for input fields looks like.
Definition: Factory.php:31
This describes a symbol.
Definition: Symbol.php:30
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21

References ILIAS\Repository\button(), ILIAS\UI\examples\MainControls\Slate\Legacy\legacy(), and ILIAS\Repository\symbol().

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 ( )

Definition at line 67 of file DrilldownTest.php.

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

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

+ Here is the call graph for this function:

◆ testConstruction()

DrilldownTest::testConstruction ( )

Definition at line 80 of file DrilldownTest.php.

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

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

+ Here is the call graph for this function:

◆ testGetItems()

DrilldownTest::testGetItems (   $menu)

Definition at line 108 of file DrilldownTest.php.

108 : void
109 {
110 $this->assertEquals(
111 [],
112 $menu->getItems()
113 );
114 }

◆ testGetLabel()

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

Definition at line 99 of file DrilldownTest.php.

99 : void
100 {
101 $this->assertEquals(
102 'root',
103 $menu->getLabel()
104 );
105 }

◆ testRendering()

DrilldownTest::testRendering ( )

Definition at line 143 of file DrilldownTest.php.

143 : void
144 {
145 $r = $this->getDefaultRenderer();
146 $f = $this->getUIFactory();
147
148 $items = [
149 $f->menu()->sub('1', [
150 $f->menu()->sub('1.1', []),
151 $f->menu()->sub('1.2', []),
152 ]),
153 $f->menu()->sub('2', [])
154 ];
155 $menu = $f->menu()->drilldown('root', $items);
156
157 $html = $r->render($menu);
158 $expected = file_get_contents(__DIR__ . "/drilldown_test.html");
159
160 $this->assertEquals(
161 $this->brutallyTrimHTML($expected),
162 $this->brutallyTrimHTML($html)
163 );
164 }

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

+ Here is the call graph for this function:

◆ testWithEntries()

DrilldownTest::testWithEntries ( )

Definition at line 116 of file DrilldownTest.php.

116 : C\Menu\Drilldown
117 {
118 $f = $this->getUIFactory();
119 $items = array(
120 $f->menu()->sub('sub', [
121 $this->button,
122 $this->glyph
123 ]),
124 $this->divider,
125 $this->button
126 );
127 $menu = $f->menu()->drilldown('root', $items);
128 $this->assertEquals(
129 $items,
130 $menu->getItems()
131 );
132 return $menu;
133 }

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

+ Here is the call graph for this function:

◆ testWithPersistenceId()

DrilldownTest::testWithPersistenceId (   $menu)

Definition at line 167 of file DrilldownTest.php.

167 : void
168 {
169 $this->assertNull($menu->getPersistenceId()) ;
170
171 $id = "some_id";
172 $this->assertEquals(
173 $id,
174 $menu->withPersistenceId($id)->getPersistenceId()
175 );
176 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ testWithWrongEntry()

DrilldownTest::testWithWrongEntry ( )

Definition at line 135 of file DrilldownTest.php.

135 : void
136 {
137 $this->expectException(InvalidArgumentException::class);
138 $f = $this->getUIFactory();
139 $f->menu()->drilldown('label', [$this->legacy]);
140 }

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 Content DrilldownTest::$legacy
protected

Definition at line 37 of file DrilldownTest.php.


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