ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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_get_image ()
 
 test_with_image ()
 
 test_with_section ()
 
 test_render_content_empty ()
 
 test_render_content_full ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer ()
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Detailed Description

Test on card implementation.

Definition at line 14 of file CardTest.php.

Member Function Documentation

◆ getFactory()

CardTest::getFactory ( )
Returns
\ILIAS\UI\Implementation\Factory

Definition at line 19 of file CardTest.php.

19 {
20 return new \ILIAS\UI\Implementation\Factory();
21 }

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

+ Here is the caller graph for this function:

◆ test_get_image()

CardTest::test_get_image ( )

Definition at line 46 of file CardTest.php.

46 {
47 $f = $this->getFactory();
48
49 $image = $f->image()->standard("src","str");
50 $c = $f->card("Card Title",$image);
51
52 $this->assertEquals($c->getImage(), $image);
53 }
getFactory()
Definition: CardTest.php:19

References getFactory().

+ Here is the call graph for this function:

◆ test_get_title()

CardTest::test_get_title ( )

Definition at line 30 of file CardTest.php.

30 {
31 $f = $this->getFactory();
32 $c = $f->card("Card Title");
33
34 $this->assertEquals($c->getTitle(), "Card Title");
35 }

References getFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

CardTest::test_implements_factory_interface ( )

Definition at line 23 of file CardTest.php.

23 {
24 $f = $this->getFactory();
25
26 $this->assertInstanceOf("ILIAS\\UI\\Factory", $f);
27 $this->assertInstanceOf( "ILIAS\\UI\\Component\\Card\\Card", $f->card("Card Title"));
28 }

References getFactory().

+ Here is the call graph for this function:

◆ test_render_content_empty()

CardTest::test_render_content_empty ( )

Definition at line 80 of file CardTest.php.

80 {
81 $f = $this->getFactory();
82 $r = $this->getDefaultRenderer();
83
84 $c = $f->card("Card Title");
85
86 $html = $r->render($c);
87
88 $expected_html =
89 "<div class=\"il-card thumbnail\">".
90 " <div class=\"caption\">".
91 " <h5 class=\"card-title\">Card Title</h5>".
92 " </div>".
93 "</div>";
94
95 $this->assertHTMLEquals($expected_html, $html);
96 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:118
getDefaultRenderer()
Definition: Base.php:100
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79

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

+ Here is the call graph for this function:

◆ test_render_content_full()

CardTest::test_render_content_full ( )

Definition at line 98 of file CardTest.php.

98 {
99 $f = $this->getFactory();
100 $r = $this->getDefaultRenderer();
101
102 $image = $f->image()->standard("src","alt");
103
104 $c = $f->card("Card Title",$image);
105
106 $content = $f->legacy("Random Content");
107
108 $c = $c->withSections(array($content));
109
110 $html = $r->render($c);
111
112 $expected_html =
113 "<div class=\"il-card thumbnail\">".
114 " <img src=\"src\" class=\"img-standard\" alt=\"alt\" />".
115 " <div class=\"caption\">".
116 " <h5 class=\"card-title\">Card Title</h5>".
117 " </div>".
118 " <div class=\"caption\">Random Content</div>".
119 "</div>";
120
121 $this->assertHTMLEquals($expected_html, $html);
122 }

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

+ Here is the call graph for this function:

◆ test_with_image()

CardTest::test_with_image ( )

Definition at line 55 of file CardTest.php.

55 {
56 $f = $this->getFactory();
57
58 $image = $f->image()->standard("src","str");
59 $c = $f->card("Card Title",$image);
60
61 $image_new = $f->image()->standard("src/new","str");
62
63 $c = $c->withImage($image_new);
64
65 $this->assertEquals($c->getImage(), $image_new);
66 }

References getFactory().

+ Here is the call graph for this function:

◆ test_with_section()

CardTest::test_with_section ( )

Definition at line 68 of file CardTest.php.

68 {
69 $f = $this->getFactory();
70
71 $c = $f->card("Card Title");
72
73 $content = $f->legacy("Random Content");
74
75 $c = $c->withSections(array($content));
76
77 $this->assertEquals($c->getSections(), array($content));
78 }

References getFactory().

+ Here is the call graph for this function:

◆ test_with_title()

CardTest::test_with_title ( )

Definition at line 37 of file CardTest.php.

37 {
38 $f = $this->getFactory();
39
40 $c = $f->card("Card Title");
41 $c = $c->withTitle("Card Title New");
42
43 $this->assertEquals($c->getTitle(), "Card Title New");
44 }

References getFactory().

+ Here is the call graph for this function:

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