ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ()
 
 getRefinery ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Test on deck implementation.

Definition at line 14 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 $factory = new class extends NoUIFactory {
22 public function card()
23 {
24 return new I\Component\Card\Factory();
25 }
26 public function deck(array $cards)
27 {
28 return new I\Component\Deck\Deck($cards, I\Component\Deck\Deck::SIZE_S);
29 }
30 };
31 return $factory;
32 }
$factory
Definition: metadata.php:58

References $factory.

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 43 of file DeckTest.php.

44 {
45 $f = $this->getFactory();
46 $c = $f->card()->standard("Card Title");
47 $d = $f->deck(array($c));
48
49 $this->assertEquals($d->getCards(), array($c));
50 }
getFactory()
Definition: DeckTest.php:19
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296

References Vendor\Package\$c, $d, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_get_size()

DeckTest::test_get_size ( )

Definition at line 62 of file DeckTest.php.

63 {
64 $f = $this->getFactory();
65
66 $c = $f->card()->standard("Card Title");
67 $d = $f->deck(array($c));
68
69 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_S);
70 }

References Vendor\Package\$c, $d, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

DeckTest::test_implements_factory_interface ( )

Definition at line 34 of file DeckTest.php.

35 {
36 $f = $this->getFactory();
37
38 $this->assertInstanceOf("ILIAS\\UI\\Factory", $f);
39 $c = $f->card()->standard("Card Title");
40 $this->assertInstanceOf("ILIAS\\UI\\Component\\Deck\\Deck", $f->deck(array($c)));
41 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_render_content()

DeckTest::test_render_content ( )

Definition at line 98 of file DeckTest.php.

99 {
100 $r = $this->getDefaultRenderer();
101 $f = $this->getFactory();
102 $c = $f->card()->standard("Card Title");
103 $d = $f->deck(array($c));
104
105 $d = $d->withCards(array($c,$c,$c,$c,$c,$c,$c))->withLargeCardsSize();
106
107 $html = $r->render($d);
108
109 $expected_html =
110 '<div class="il-deck">
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"><div class="card-title">Card Title</div></div></div></div>
113 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><div class="card-title">Card Title</div></div></div></div>
114 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><div class="card-title">Card Title</div></div></div></div>
115 </div>
116 <div class="row row-eq-height">
117 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><div class="card-title">Card Title</div></div></div></div>
118 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><div class="card-title">Card Title</div></div></div></div>
119 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><div class="card-title">Card Title</div></div></div></div>
120 </div>
121 <div class="row row-eq-height">
122 <div class="col-sm-12 col-md-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption"><div class="card-title">Card Title</div></div></div></div>
123 </div>
124 </div>';
125
126 $this->assertHTMLEquals($expected_html, $html);
127 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268

References Vendor\Package\$c, $d, Vendor\Package\$f, 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 52 of file DeckTest.php.

53 {
54 $f = $this->getFactory();
55 $c = $f->card()->standard("Card Title");
56 $d = $f->deck(array($c));
57
58 $d = $d->withCards(array($c,$c));
59 $this->assertEquals($d->getCards(), array($c,$c));
60 }

References Vendor\Package\$c, $d, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_with_size()

DeckTest::test_with_size ( )

Definition at line 72 of file DeckTest.php.

73 {
74 $f = $this->getFactory();
75
76 $c = $f->card()->standard("Card Title");
77 $d = $f->deck(array($c));
78
79 $d = $d->withExtraSmallCardsSize();
80 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_XS);
81
82 $d = $d->withSmallCardsSize();
83 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_S);
84
85 $d = $d->withNormalCardsSize();
86 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_M);
87
88 $d = $d->withLargeCardsSize();
89 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_L);
90
91 $d = $d->withExtraLargeCardsSize();
92 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_XL);
93
94 $d = $d->withFullSizedCardsSize();
95 $this->assertEquals($d->getCardsSize(), C\Deck\Deck::SIZE_FULL);
96 }

References Vendor\Package\$c, $d, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

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