ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
CardTest Class Reference

Test on card implementation. More...

+ Inheritance diagram for CardTest:
+ Collaboration diagram for CardTest:

Public Member Functions

 getFactory ()
 
 test_implements_factory_interface ()
 
 test_get_title ()
 
 test_with_title ()
 
 test_with_title_action ()
 
 test_with_highlight ()
 
 test_get_image ()
 
 test_with_image ()
 
 test_with_section ()
 
 test_render_content_empty ()
 
 test_render_content_full ()
 
 test_render_content_with_highlight ()
 
- 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 card implementation.

Definition at line 13 of file CardTest.php.

Member Function Documentation

◆ getFactory()

CardTest::getFactory ( )
Returns

Definition at line 19 of file CardTest.php.

Referenced by test_get_image(), test_get_title(), test_implements_factory_interface(), test_render_content_empty(), test_render_content_full(), test_render_content_with_highlight(), test_with_highlight(), test_with_image(), test_with_section(), test_with_title(), and test_with_title_action().

20  {
21  return new \ILIAS\UI\Implementation\Factory();
22  }
+ Here is the caller graph for this function:

◆ test_get_image()

CardTest::test_get_image ( )

Definition at line 66 of file CardTest.php.

References getFactory().

67  {
68  $f = $this->getFactory();
69 
70  $image = $f->image()->standard("src", "str");
71  $c = $f->card("Card Title", $image);
72 
73  $this->assertEquals($c->getImage(), $image);
74  }
getFactory()
Definition: CardTest.php:19
+ Here is the call graph for this function:

◆ test_get_title()

CardTest::test_get_title ( )

Definition at line 32 of file CardTest.php.

References getFactory().

33  {
34  $f = $this->getFactory();
35  $c = $f->card("Card Title");
36 
37  $this->assertEquals($c->getTitle(), "Card Title");
38  }
getFactory()
Definition: CardTest.php:19
+ Here is the call graph for this function:

◆ test_implements_factory_interface()

CardTest::test_implements_factory_interface ( )

Definition at line 24 of file CardTest.php.

References getFactory().

25  {
26  $f = $this->getFactory();
27 
28  $this->assertInstanceOf("ILIAS\\UI\\Factory", $f);
29  $this->assertInstanceOf("ILIAS\\UI\\Component\\Card\\Card", $f->card("Card Title"));
30  }
getFactory()
Definition: CardTest.php:19
+ Here is the call graph for this function:

◆ test_render_content_empty()

CardTest::test_render_content_empty ( )

Definition at line 103 of file CardTest.php.

References $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

104  {
105  $f = $this->getFactory();
106  $r = $this->getDefaultRenderer();
107 
108  $c = $f->card("Card Title");
109 
110  $html = $r->render($c);
111 
112  $expected_html =
113  "<div class=\"il-card thumbnail\">" .
114  " <div class=\"card-no-highlight\"></div>" .
115  " <div class=\"caption\">" .
116  " <h5 class=\"card-title\">Card Title</h5>" .
117  " </div>" .
118  "</div>";
119 
120  $this->assertHTMLEquals($expected_html, $html);
121  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getFactory()
Definition: CardTest.php:19
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_content_full()

CardTest::test_render_content_full ( )

Definition at line 123 of file CardTest.php.

References $html, $r, array, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

124  {
125  $f = $this->getFactory();
126  $r = $this->getDefaultRenderer();
127 
128  $image = $f->image()->standard("src", "alt");
129 
130  $c = $f->card("Card Title", $image);
131 
132  $content = $f->legacy("Random Content");
133 
134  $c = $c->withSections(array($content));
135 
136  $html = $r->render($c);
137 
138  $expected_html =
139  "<div class=\"il-card thumbnail\">" .
140  " <img src=\"src\" class=\"img-standard\" alt=\"alt\" />" .
141  " <div class=\"card-no-highlight\"></div>" .
142  " <div class=\"caption\">" .
143  " <h5 class=\"card-title\">Card Title</h5>" .
144  " </div>" .
145  " <div class=\"caption\">Random Content</div>" .
146  "</div>";
147 
148  $this->assertHTMLEquals($expected_html, $html);
149  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getFactory()
Definition: CardTest.php:19
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
Create styles array
The data for the language used.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_content_with_highlight()

CardTest::test_render_content_with_highlight ( )

Definition at line 151 of file CardTest.php.

References $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

152  {
153  $f = $this->getFactory();
154  $r = $this->getDefaultRenderer();
155 
156  $image = $f->image()->standard("src", "alt");
157 
158  $c = $f->card("Card Title", $image)->withHighlight(true);
159 
160  $html = $r->render($c);
161 
162  $expected_html =
163  "<div class=\"il-card thumbnail\">" .
164  " <img src=\"src\" class=\"img-standard\" alt=\"alt\" />" .
165  " <div class=\"card-highlight\"></div>" .
166  " <div class=\"caption\">" .
167  " <h5 class=\"card-title\">Card Title</h5>" .
168  " </div>" .
169  "</div>";
170 
171  $this->assertHTMLEquals($expected_html, $html);
172  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
getFactory()
Definition: CardTest.php:19
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_with_highlight()

CardTest::test_with_highlight ( )

Definition at line 58 of file CardTest.php.

References getFactory().

59  {
60  $f = $this->getFactory();
61  $c = $f->card("Card Title");
62  $c = $c->withHighlight(true);
63  $this->assertTrue($c->isHighlighted());
64  }
getFactory()
Definition: CardTest.php:19
+ Here is the call graph for this function:

◆ test_with_image()

CardTest::test_with_image ( )

Definition at line 76 of file CardTest.php.

References getFactory().

77  {
78  $f = $this->getFactory();
79 
80  $image = $f->image()->standard("src", "str");
81  $c = $f->card("Card Title", $image);
82 
83  $image_new = $f->image()->standard("src/new", "str");
84 
85  $c = $c->withImage($image_new);
86 
87  $this->assertEquals($c->getImage(), $image_new);
88  }
getFactory()
Definition: CardTest.php:19
+ Here is the call graph for this function:

◆ test_with_section()

CardTest::test_with_section ( )

Definition at line 90 of file CardTest.php.

References array, and getFactory().

91  {
92  $f = $this->getFactory();
93 
94  $c = $f->card("Card Title");
95 
96  $content = $f->legacy("Random Content");
97 
98  $c = $c->withSections(array($content));
99 
100  $this->assertEquals($c->getSections(), array($content));
101  }
getFactory()
Definition: CardTest.php:19
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ test_with_title()

CardTest::test_with_title ( )

Definition at line 40 of file CardTest.php.

References getFactory().

41  {
42  $f = $this->getFactory();
43 
44  $c = $f->card("Card Title");
45  $c = $c->withTitle("Card Title New");
46 
47  $this->assertEquals($c->getTitle(), "Card Title New");
48  }
getFactory()
Definition: CardTest.php:19
+ Here is the call graph for this function:

◆ test_with_title_action()

CardTest::test_with_title_action ( )

Definition at line 50 of file CardTest.php.

References getFactory().

51  {
52  $f = $this->getFactory();
53  $c = $f->card("Card Title");
54  $c = $c->withTitleAction("newAction");
55  $this->assertEquals("newAction", $c->getTitleAction());
56  }
getFactory()
Definition: CardTest.php:19
+ Here is the call graph for this function:

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