ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
DeckTest Class Reference

Test on deck implementation. More...

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

Public Member Functions

 getFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetCards ()
 
 testWithCards ()
 
 testGetSize ()
 
 testWithSize ()
 
 testRenderContent ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getHelpTextRetriever ()
 
 getUploadLimitResolver ()
 
 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

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 testGetCards(), testGetSize(), testImplementsFactoryInterface(), testRenderContent(), testWithCards(), and testWithSize().

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:

◆ testGetCards()

DeckTest::testGetCards ( )

Definition at line 55 of file DeckTest.php.

References Vendor\Package\$c, Vendor\Package\$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  }
getFactory()
Definition: DeckTest.php:32
+ Here is the call graph for this function:

◆ testGetSize()

DeckTest::testGetSize ( )

Definition at line 74 of file DeckTest.php.

References Vendor\Package\$c, Vendor\Package\$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  }
getFactory()
Definition: DeckTest.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

DeckTest::testImplementsFactoryInterface ( )

Definition at line 46 of file DeckTest.php.

References Vendor\Package\$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  }
getFactory()
Definition: DeckTest.php:32
+ Here is the call graph for this function:

◆ testRenderContent()

DeckTest::testRenderContent ( )

Definition at line 110 of file DeckTest.php.

References Vendor\Package\$c, Vendor\Package\$d, Vendor\Package\$f, $r, 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:377
getFactory()
Definition: DeckTest.php:32
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

◆ testWithCards()

DeckTest::testWithCards ( )

Definition at line 64 of file DeckTest.php.

References Vendor\Package\$c, Vendor\Package\$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  }
getFactory()
Definition: DeckTest.php:32
+ Here is the call graph for this function:

◆ testWithSize()

DeckTest::testWithSize ( )

Definition at line 84 of file DeckTest.php.

References Vendor\Package\$c, Vendor\Package\$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  }
getFactory()
Definition: DeckTest.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

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