ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ListingTest Class Reference

Test on button implementation. More...

+ Inheritance diagram for ListingTest:
+ Collaboration diagram for ListingTest:

Public Member Functions

 getListingFactory ()
 
 test_implements_factory_interface ()
 
 test_ordered_get_items ()
 
 test_unordered_get_items ()
 
 test_descriptive_get_items ()
 
 test_ordered_with_items ()
 
 test_unordered_with_items ()
 
 test_descriptive_with_items ()
 
 test_render_ordered_listing ()
 
 test_descriptive_invalid_items2 ()
 
 test_descriptive_invalid_items3 ()
 
 test_render_unordered_listing ()
 
 test_render_descriptive_listing ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Detailed Description

Test on button implementation.

Definition at line 13 of file ListingTest.php.

Member Function Documentation

◆ getListingFactory()

ListingTest::getListingFactory ( )
Returns
\ILIAS\UI\Implementation\Component\Listing\Factory

Definition at line 19 of file ListingTest.php.

20 {
21 return new \ILIAS\UI\Implementation\Component\Listing\Factory();
22 }

Referenced by test_descriptive_get_items(), test_descriptive_invalid_items2(), test_descriptive_invalid_items3(), test_descriptive_with_items(), test_implements_factory_interface(), test_ordered_get_items(), test_ordered_with_items(), test_render_descriptive_listing(), test_render_ordered_listing(), test_render_unordered_listing(), test_unordered_get_items(), and test_unordered_with_items().

+ Here is the caller graph for this function:

◆ test_descriptive_get_items()

ListingTest::test_descriptive_get_items ( )

Definition at line 63 of file ListingTest.php.

64 {
65 $f = $this->getListingFactory();
66 $l = $f->descriptive(array("k1" => "c1","k2" => "c2"));
67
68 $items = array("k1" => "c1","k2" => "c2");
69 $this->assertEquals($l->getItems(), $items);
70 }
global $l
Definition: afr.php:30

References $f, $l, and getListingFactory().

+ Here is the call graph for this function:

◆ test_descriptive_invalid_items2()

ListingTest::test_descriptive_invalid_items2 ( )

Definition at line 116 of file ListingTest.php.

117 {
118 $f = $this->getListingFactory();
119
120 try {
121 $f->descriptive(array("1"));
122 } catch (InvalidArgumentException $e) {
123 $this->assertEquals(get_class($e), "InvalidArgumentException");
124 }
125 }

References $f, and getListingFactory().

+ Here is the call graph for this function:

◆ test_descriptive_invalid_items3()

ListingTest::test_descriptive_invalid_items3 ( )

Definition at line 127 of file ListingTest.php.

128 {
129 $f = $this->getListingFactory();
130
131 try {
132 $f->descriptive(array("1","1"));
133 } catch (InvalidArgumentException $e) {
134 $this->assertEquals(get_class($e), "InvalidArgumentException");
135 }
136 }

References $f, and getListingFactory().

+ Here is the call graph for this function:

◆ test_descriptive_with_items()

ListingTest::test_descriptive_with_items ( )

Definition at line 90 of file ListingTest.php.

91 {
92 $f = $this->getListingFactory();
93 $l = $f->descriptive(array())->withItems(array("k1" => "c1","k2" => "c2"));
94
95 $items = array("k1" => "c1","k2" => "c2");
96 $this->assertEquals($l->getItems(), $items);
97 }

References $f, $l, and getListingFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ListingTest::test_implements_factory_interface ( )

Definition at line 25 of file ListingTest.php.

26 {
27 $f = $this->getListingFactory();
28
29 $this->assertInstanceOf("ILIAS\\UI\\Component\\Listing\\Factory", $f);
30 $this->assertInstanceOf(
31 "ILIAS\\UI\\Component\\Listing\\Ordered",
32 $f->ordered(array("1"))
33 );
34 $this->assertInstanceOf(
35 "ILIAS\\UI\\Component\\Listing\\Unordered",
36 $f->unordered(array("1"))
37 );
38 $this->assertInstanceOf(
39 "ILIAS\\UI\\Component\\Listing\\Descriptive",
40 $f->descriptive(array("k1" => "c1"))
41 );
42 }

References $f, and getListingFactory().

+ Here is the call graph for this function:

◆ test_ordered_get_items()

ListingTest::test_ordered_get_items ( )

Definition at line 45 of file ListingTest.php.

46 {
47 $f = $this->getListingFactory();
48 $l = $f->ordered(array("1","2"));
49
50 $items = array("1","2");
51 $this->assertEquals($l->getItems(), $items);
52 }

References $f, $l, and getListingFactory().

+ Here is the call graph for this function:

◆ test_ordered_with_items()

ListingTest::test_ordered_with_items ( )

Definition at line 72 of file ListingTest.php.

73 {
74 $f = $this->getListingFactory();
75 $l = $f->ordered(array())->withItems(array("1","2"));
76
77 $items = array("1","2");
78 $this->assertEquals($l->getItems(), $items);
79 }

References $f, $l, and getListingFactory().

+ Here is the call graph for this function:

◆ test_render_descriptive_listing()

ListingTest::test_render_descriptive_listing ( )

Definition at line 155 of file ListingTest.php.

156 {
157 $f = $this->getListingFactory();
158 $r = $this->getDefaultRenderer();
159 $l = $f->descriptive(array("k1" => "c1","k2" => "c2"));
160
161 $html = $this->normalizeHTML($r->render($l));
162
163 $expected = "<dl>" .
164 "\t\t<dt>k1</dt>" .
165 "\t<dd>c1</dd>" .
166 "\t\t<dt>k2</dt>" .
167 "\t<dd>c2</dd>\t" .
168 "</dl>";
169
170 $this->assertEquals($expected, $html);
171 }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
normalizeHTML($html)
Definition: Base.php:261
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79

References $f, $html, $l, $r, ILIAS_UI_TestBase\getDefaultRenderer(), getListingFactory(), and ILIAS_UI_TestBase\normalizeHTML().

+ Here is the call graph for this function:

◆ test_render_ordered_listing()

ListingTest::test_render_ordered_listing ( )

Definition at line 100 of file ListingTest.php.

101 {
102 $f = $this->getListingFactory();
103 $r = $this->getDefaultRenderer();
104 $l = $f->ordered(array("1","2"));
105
106 $html = $this->normalizeHTML($r->render($l));
107
108 $expected = "<ol>" .
109 "\t\t<li>1</li>" .
110 "\t\t<li>2</li>\t" .
111 "</ol>";
112
113 $this->assertEquals($expected, $html);
114 }

References $f, $html, $l, $r, ILIAS_UI_TestBase\getDefaultRenderer(), getListingFactory(), and ILIAS_UI_TestBase\normalizeHTML().

+ Here is the call graph for this function:

◆ test_render_unordered_listing()

ListingTest::test_render_unordered_listing ( )

Definition at line 139 of file ListingTest.php.

140 {
141 $f = $this->getListingFactory();
142 $r = $this->getDefaultRenderer();
143 $l = $f->unordered(array("1","2"));
144
145 $html = $this->normalizeHTML($r->render($l));
146
147 $expected = "<ul>" .
148 "\t\t<li>1</li>" .
149 "\t\t<li>2</li>\t" .
150 "</ul>";
151
152 $this->assertEquals($expected, $html);
153 }

References $f, $html, $l, $r, ILIAS_UI_TestBase\getDefaultRenderer(), getListingFactory(), and ILIAS_UI_TestBase\normalizeHTML().

+ Here is the call graph for this function:

◆ test_unordered_get_items()

ListingTest::test_unordered_get_items ( )

Definition at line 54 of file ListingTest.php.

55 {
56 $f = $this->getListingFactory();
57 $l = $f->unordered(array("1","2"));
58
59 $items = array("1","2");
60 $this->assertEquals($l->getItems(), $items);
61 }

References $f, $l, and getListingFactory().

+ Here is the call graph for this function:

◆ test_unordered_with_items()

ListingTest::test_unordered_with_items ( )

Definition at line 81 of file ListingTest.php.

82 {
83 $f = $this->getListingFactory();
84 $l = $f->unordered(array())->withItems(array("1","2"));
85
86 $items = array("1","2");
87 $this->assertEquals($l->getItems(), $items);
88 }

References $f, $l, and getListingFactory().

+ Here is the call graph for this function:

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