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

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_with_image(), test_with_section(), and test_with_title().

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

◆ test_get_image()

CardTest::test_get_image ( )

Definition at line 46 of file CardTest.php.

References getFactory().

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
+ Here is the call graph for this function:

◆ test_get_title()

CardTest::test_get_title ( )

Definition at line 30 of file CardTest.php.

References getFactory().

30  {
31  $f = $this->getFactory();
32  $c = $f->card("Card Title");
33 
34  $this->assertEquals($c->getTitle(), "Card Title");
35  }
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 23 of file CardTest.php.

References getFactory().

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  }
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 80 of file CardTest.php.

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

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  }
getFactory()
Definition: CardTest.php:19
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:118
getDefaultRenderer()
Definition: Base.php:100
$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 98 of file CardTest.php.

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

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  }
getFactory()
Definition: CardTest.php:19
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:118
Create styles array
The data for the language used.
getDefaultRenderer()
Definition: Base.php:100
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_with_image()

CardTest::test_with_image ( )

Definition at line 55 of file CardTest.php.

References getFactory().

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  }
getFactory()
Definition: CardTest.php:19
+ Here is the call graph for this function:

◆ test_with_section()

CardTest::test_with_section ( )

Definition at line 68 of file CardTest.php.

References array, and getFactory().

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  }
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 37 of file CardTest.php.

References getFactory().

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  }
getFactory()
Definition: CardTest.php:19
+ Here is the call graph for this function:

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