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

Test on deck implementation. More...

+ Inheritance diagram for DeckTest:
+ Collaboration diagram for DeckTest:

Public Member Functions

 getFactory ()
 
 test_implements_factory_interface ()
 
 test_get_cards ()
 
 test_with_cards ()
 
 test_get_size ()
 
 test_with_size ()
 
 test_render_content ()
 
- 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 deck implementation.

Definition at line 13 of file DeckTest.php.

Member Function Documentation

◆ getFactory()

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

Definition at line 19 of file DeckTest.php.

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

Referenced by test_get_cards(), test_get_size(), test_implements_factory_interface(), test_render_content(), test_with_cards(), and test_with_size().

+ Here is the caller graph for this function:

◆ test_get_cards()

DeckTest::test_get_cards ( )

Definition at line 33 of file DeckTest.php.

34 {
35 $f = $this->getFactory();
36 $c = $f->card("Card Title");
37 $d = $f->deck(array($c));
38
39 $this->assertEquals($d->getCards(), array($c));
40 }
getFactory()
Definition: DeckTest.php:19
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296

References $d, and getFactory().

+ Here is the call graph for this function:

◆ test_get_size()

DeckTest::test_get_size ( )

Definition at line 52 of file DeckTest.php.

53 {
54 $f = $this->getFactory();
55
56 $c = $f->card("Card Title");
57 $d = $f->deck(array($c));
58
59 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_S);
60 }

References $d, and getFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

DeckTest::test_implements_factory_interface ( )

Definition at line 24 of file DeckTest.php.

25 {
26 $f = $this->getFactory();
27
28 $this->assertInstanceOf("ILIAS\\UI\\Factory", $f);
29 $c = $f->card("Card Title");
30 $this->assertInstanceOf("ILIAS\\UI\\Component\\Deck\\Deck", $f->deck(array($c)));
31 }

References getFactory().

+ Here is the call graph for this function:

◆ test_render_content()

DeckTest::test_render_content ( )

Definition at line 88 of file DeckTest.php.

89 {
90 $r = $this->getDefaultRenderer();
91 $f = $this->getFactory();
92 $c = $f->card("Card Title");
93 $d = $f->deck(array($c));
94
95 $d = $d->withCards(array($c,$c,$c,$c,$c,$c,$c))->withLargeCardsSize();
96
97 $html = $r->render($d);
98
99 $expected_html =
100 '<div class="il-deck">
101 <div class="row row-eq-height">
102 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><h5 class="card-title">Card Title</h5></div></div></div>
103 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><h5 class="card-title">Card Title</h5></div></div></div>
104 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><h5 class="card-title">Card Title</h5></div></div></div>
105 </div>
106 <div class="row row-eq-height">
107 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><h5 class="card-title">Card Title</h5></div></div></div>
108 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><h5 class="card-title">Card Title</h5></div></div></div>
109 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><h5 class="card-title">Card Title</h5></div></div></div>
110 </div>
111 <div class="row row-eq-height">
112 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><h5 class="card-title">Card Title</h5></div></div></div>
113 </div>
114 </div>';
115
116 $this->assertHTMLEquals($expected_html, $html);
117 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79

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

+ Here is the call graph for this function:

◆ test_with_cards()

DeckTest::test_with_cards ( )

Definition at line 42 of file DeckTest.php.

43 {
44 $f = $this->getFactory();
45 $c = $f->card("Card Title");
46 $d = $f->deck(array($c));
47
48 $d = $d->withCards(array($c,$c));
49 $this->assertEquals($d->getCards(), array($c,$c));
50 }

References $d, and getFactory().

+ Here is the call graph for this function:

◆ test_with_size()

DeckTest::test_with_size ( )

Definition at line 62 of file DeckTest.php.

63 {
64 $f = $this->getFactory();
65
66 $c = $f->card("Card Title");
67 $d = $f->deck(array($c));
68
69 $d = $d->withExtraSmallCardsSize();
70 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_XS);
71
72 $d = $d->withSmallCardsSize();
73 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_S);
74
75 $d = $d->withNormalCardsSize();
76 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_M);
77
78 $d = $d->withLargeCardsSize();
79 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_L);
80
81 $d = $d->withExtraLargeCardsSize();
82 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_XL);
83
84 $d = $d->withFullSizedCardsSize();
85 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_FULL);
86 }

References $d, and getFactory().

+ Here is the call graph for this function:

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