ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ItemGroupTest Class Reference

Test items groups. More...

+ Inheritance diagram for ItemGroupTest:
+ Collaboration diagram for ItemGroupTest:

Public Member Functions

 getFactory ()
 
 test_implements_factory_interface ()
 
 test_get_title ()
 
 test_get_items ()
 
 test_with_actions ()
 
 test_render_base ()
 
 test_render_with_actions ()
 
- 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

Test items groups.

Definition at line 14 of file ItemGroupTest.php.

Member Function Documentation

◆ getFactory()

ItemGroupTest::getFactory ( )
Returns

Definition at line 20 of file ItemGroupTest.php.

Referenced by test_get_items(), test_get_title(), test_implements_factory_interface(), test_render_base(), test_render_with_actions(), and test_with_actions().

21  {
22  return new I\Component\Item\Factory;
23  }
+ Here is the caller graph for this function:

◆ test_get_items()

ItemGroupTest::test_get_items ( )

Definition at line 48 of file ItemGroupTest.php.

References $c, Vendor\Package\$f, and getFactory().

49  {
50  $f = $this->getFactory();
51 
52  $items = array(
53  $f->standard("title1"),
54  $f->standard("title2")
55  );
56 
57  $c = $f->group("group", $items);
58 
59  $this->assertEquals($c->getItems(), $items);
60  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ test_get_title()

ItemGroupTest::test_get_title ( )

Definition at line 37 of file ItemGroupTest.php.

References $c, Vendor\Package\$f, and getFactory().

38  {
39  $f = $this->getFactory();
40  $c = $f->group("group", array(
41  $f->standard("title1"),
42  $f->standard("title2")
43  ));
44 
45  $this->assertEquals($c->getTitle(), "group");
46  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ItemGroupTest::test_implements_factory_interface ( )

Definition at line 25 of file ItemGroupTest.php.

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

26  {
27  $f = $this->getFactory();
28 
29  $group = $f->group("group", array(
30  $f->standard("title1"),
31  $f->standard("title2")
32  ));
33 
34  $this->assertInstanceOf("ILIAS\\UI\\Component\\Item\\Group", $group);
35  }
+ Here is the call graph for this function:

◆ test_render_base()

ItemGroupTest::test_render_base ( )

Definition at line 80 of file ItemGroupTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

81  {
82  $f = $this->getFactory();
83  $r = $this->getDefaultRenderer();
84 
85  $items = array(
86  $f->standard("title1"),
87  $f->standard("title2")
88  );
89 
90  $c = $f->group("group", $items);
91 
92  $html = $r->render($c);
93 
94  $expected = <<<EOT
95 <div class="il-item-group">
96  <h3>group</h3>
97  <div class="il-item-group-items">
98  <div class="il-std-item-container"><div class="il-item il-std-item ">
99  <div class="il-item-title">title1</div>
100  </div></div><div class="il-std-item-container"><div class="il-item il-std-item ">
101  <div class="il-item-title">title2</div>
102  </div></div>
103  </div>
104 </div>
105 EOT;
106  $this->assertHTMLEquals(
107  $this->brutallyTrimHTML($expected),
108  $this->brutallyTrimHTML($html)
109  );
110  }
$c
Definition: cli.php:37
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:372
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
+ Here is the call graph for this function:

◆ test_render_with_actions()

ItemGroupTest::test_render_with_actions ( )

Definition at line 112 of file ItemGroupTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

113  {
114  $f = $this->getFactory();
115  $r = $this->getDefaultRenderer();
116 
117  $actions = new I\Component\Dropdown\Standard(array(
118  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
119  new I\Component\Button\Shy("GitHub", "https://www.github.com")
120  ));
121  $items = array(
122  $f->standard("title1"),
123  $f->standard("title2")
124  );
125 
126  $c = $f->group("group", $items)->withActions($actions);
127 
128  $html = $r->render($c);
129 
130  $expected = <<<EOT
131 <div class="il-item-group">
132 <h3>group</h3><div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span></button>
133  <ul class="dropdown-menu">
134  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
135  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
136  </ul>
137  </div>
138  <div class="il-item-group-items">
139  <div class="il-std-item-container"><div class="il-item il-std-item ">
140  <div class="il-item-title">title1</div>
141  </div></div><div class="il-std-item-container"><div class="il-item il-std-item ">
142  <div class="il-item-title">title2</div>
143  </div></div>
144  </div>
145 </div>
146 EOT;
147  $this->assertHTMLEquals(
148  $this->brutallyTrimHTML($expected),
149  $this->brutallyTrimHTML($html)
150  );
151  }
$c
Definition: cli.php:37
Class ChatMainBarProvider .
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:372
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
+ Here is the call graph for this function:

◆ test_with_actions()

ItemGroupTest::test_with_actions ( )

Definition at line 62 of file ItemGroupTest.php.

References $c, Vendor\Package\$f, and getFactory().

63  {
64  $f = $this->getFactory();
65 
66  $actions = new I\Component\Dropdown\Standard(array(
67  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
68  new I\Component\Button\Shy("GitHub", "https://www.github.com")
69  ));
70  $items = array(
71  $f->standard("title1"),
72  $f->standard("title2")
73  );
74 
75  $c = $f->group("group", $items)->withActions($actions);
76 
77  $this->assertEquals($c->getActions(), $actions);
78  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

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