ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
DeckTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Test on deck implementation.

Definition at line 30 of file DeckTest.php.

Member Function Documentation

◆ getFactory()

DeckTest::getFactory ( )

Definition at line 32 of file DeckTest.php.

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

32  : NoUIFactory
33  {
34  return new class () extends NoUIFactory {
35  public function card(): C\Card\Factory
36  {
37  return new I\Component\Card\Factory();
38  }
39  public function deck(array $cards): C\Deck\Deck
40  {
41  return new I\Component\Deck\Deck($cards, C\Deck\Deck::SIZE_S);
42  }
43  };
44  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ test_get_cards()

DeckTest::test_get_cards ( )

Definition at line 55 of file DeckTest.php.

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

55  : void
56  {
57  $f = $this->getFactory();
58  $c = $f->card()->standard("Card Title");
59  $d = $f->deck(array($c));
60 
61  $this->assertEquals($d->getCards(), array($c));
62  }
$c
Definition: cli.php:38
getFactory()
Definition: DeckTest.php:32
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
+ Here is the call graph for this function:

◆ test_get_size()

DeckTest::test_get_size ( )

Definition at line 74 of file DeckTest.php.

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

74  : void
75  {
76  $f = $this->getFactory();
77 
78  $c = $f->card()->standard("Card Title");
79  $d = $f->deck(array($c));
80 
81  $this->assertEquals(C\Deck\Deck::SIZE_S, $d->getCardsSize());
82  }
$c
Definition: cli.php:38
getFactory()
Definition: DeckTest.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
+ Here is the call graph for this function:

◆ test_implements_factory_interface()

DeckTest::test_implements_factory_interface ( )

Definition at line 46 of file DeckTest.php.

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

46  : void
47  {
48  $f = $this->getFactory();
49 
50  $this->assertInstanceOf("ILIAS\\UI\\Factory", $f);
51  $c = $f->card()->standard("Card Title");
52  $this->assertInstanceOf("ILIAS\\UI\\Component\\Deck\\Deck", $f->deck(array($c)));
53  }
$c
Definition: cli.php:38
getFactory()
Definition: DeckTest.php:32
+ Here is the call graph for this function:

◆ test_render_content()

DeckTest::test_render_content ( )

Definition at line 110 of file DeckTest.php.

References $c, $d, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

110  : void
111  {
112  $r = $this->getDefaultRenderer();
113  $f = $this->getFactory();
114  $c = $f->card()->standard("Card Title");
115  $d = $f->deck(array($c));
116 
117  $d = $d->withCards(array($c,$c,$c,$c,$c,$c,$c))->withLargeCardsSize();
118 
119  $html = $this->brutallyTrimHTML($r->render($d));
120 
121  $expected_html =
122  '<div class="il-deck"><div class="row row-eq-height">
123  <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption card-title">Card Title</div></div></div>
124  <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption card-title">Card Title</div></div></div>
125  <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption card-title">Card Title</div></div></div>
126  <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption card-title">Card Title</div></div></div>
127  <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption card-title">Card Title</div></div></div>
128  <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption card-title">Card Title</div></div></div>
129  <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4"><div class="il-card thumbnail"><div class="card-no-highlight"></div><div class="caption card-title">Card Title</div></div></div>
130  </div>
131  </div>';
132 
133  $this->assertHTMLEquals($this->brutallyTrimHTML($expected_html), $html);
134  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
getFactory()
Definition: DeckTest.php:32
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
+ Here is the call graph for this function:

◆ test_with_cards()

DeckTest::test_with_cards ( )

Definition at line 64 of file DeckTest.php.

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

64  : void
65  {
66  $f = $this->getFactory();
67  $c = $f->card()->standard("Card Title");
68  $d = $f->deck(array($c));
69 
70  $d = $d->withCards(array($c,$c));
71  $this->assertEquals($d->getCards(), array($c,$c));
72  }
$c
Definition: cli.php:38
getFactory()
Definition: DeckTest.php:32
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
+ Here is the call graph for this function:

◆ test_with_size()

DeckTest::test_with_size ( )

Definition at line 84 of file DeckTest.php.

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

84  : void
85  {
86  $f = $this->getFactory();
87 
88  $c = $f->card()->standard("Card Title");
89  $d = $f->deck(array($c));
90 
91  $d = $d->withExtraSmallCardsSize();
92  $this->assertEquals(C\Deck\Deck::SIZE_XS, $d->getCardsSize());
93 
94  $d = $d->withSmallCardsSize();
95  $this->assertEquals(C\Deck\Deck::SIZE_S, $d->getCardsSize());
96 
97  $d = $d->withNormalCardsSize();
98  $this->assertEquals(C\Deck\Deck::SIZE_M, $d->getCardsSize());
99 
100  $d = $d->withLargeCardsSize();
101  $this->assertEquals(C\Deck\Deck::SIZE_L, $d->getCardsSize());
102 
103  $d = $d->withExtraLargeCardsSize();
104  $this->assertEquals(C\Deck\Deck::SIZE_XL, $d->getCardsSize());
105 
106  $d = $d->withFullSizedCardsSize();
107  $this->assertEquals(C\Deck\Deck::SIZE_FULL, $d->getCardsSize());
108  }
$c
Definition: cli.php:38
getFactory()
Definition: DeckTest.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
+ Here is the call graph for this function:

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