ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 

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(): I\Component\Card\Factory
36  {
37  return new I\Component\Card\Factory();
38  }
39  public function deck(array $cards): I\Component\Deck\Deck
40  {
41  return new I\Component\Deck\Deck($cards, C\Deck\Deck::SIZE_S);
42  }
43  };
44  }
+ Here is the caller graph for this function:

◆ testGetCards()

DeckTest::testGetCards ( )

Definition at line 55 of file DeckTest.php.

References $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
$c
Definition: deliver.php:25
+ Here is the call graph for this function:

◆ testGetSize()

DeckTest::testGetSize ( )

Definition at line 74 of file DeckTest.php.

References $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
$c
Definition: deliver.php:25
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

DeckTest::testImplementsFactoryInterface ( )

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

◆ testRenderContent()

DeckTest::testRenderContent ( )

Definition at line 110 of file DeckTest.php.

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

◆ testWithCards()

DeckTest::testWithCards ( )

Definition at line 64 of file DeckTest.php.

References $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
$c
Definition: deliver.php:25
+ Here is the call graph for this function:

◆ testWithSize()

DeckTest::testWithSize ( )

Definition at line 84 of file DeckTest.php.

References $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
$c
Definition: deliver.php:25
+ Here is the call graph for this function:

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