ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
DividerTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once(__DIR__ . "/../../../../libs/composer/vendor/autoload.php");
22 require_once(__DIR__ . "/../../Base.php");
23 
24 use ILIAS\UI\Component as C;
26 
31 {
32  protected function getFactory(): C\Divider\Factory
33  {
34  return new I\Component\Divider\Factory();
35  }
36 
37  public function testImplementsFactoryInterface(): void
38  {
39  $f = $this->getFactory();
40 
41  $this->assertInstanceOf("ILIAS\\UI\\Component\\Divider\\Horizontal", $f->horizontal());
42  }
43 
44  public function testWithLabel(): void
45  {
46  $f = $this->getFactory();
47  $c = $f->horizontal()->withLabel("label");
48 
49  $this->assertEquals("label", $c->getLabel());
50  }
51 
52  public function testRenderHorizontalEmpty(): void
53  {
54  $f = $this->getFactory();
55  $r = $this->getDefaultRenderer();
56 
57  $c = $f->horizontal();
58 
59  $html = trim($r->render($c));
60 
61  $expected_html = "<hr/>";
62 
63  $this->assertHTMLEquals($expected_html, $html);
64  }
65 
66  public function testRenderHorizontalWithLabel(): void
67  {
68  $f = $this->getFactory();
69  $r = $this->getDefaultRenderer();
70 
71  $c = $f->horizontal()->withLabel("label");
72 
73  $html = trim($r->render($c));
74  $expected_html = '<hr class="il-divider-with-label" /><h4 class="il-divider">label</h4>';
75 
76  $this->assertHTMLEquals("<div>" . $expected_html . "</div>", "<div>" . $html . "</div>");
77  }
78 
79  public function testRenderVertical(): void
80  {
81  $f = $this->getFactory();
82  $r = $this->getDefaultRenderer();
83 
84  $c = $f->vertical();
85 
86  $html = trim($r->render($c));
87  $expected_html = '<span class="glyphicon il-divider-vertical" aria-hidden="true"></span>';
88 
89  $this->assertHTMLEquals("<div>" . $expected_html . "</div>", "<div>" . $html . "</div>");
90  }
91 }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
testImplementsFactoryInterface()
Definition: DividerTest.php:37
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testRenderHorizontalEmpty()
Definition: DividerTest.php:52
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
Provides common functionality for UI tests.
Definition: Base.php:310
testRenderHorizontalWithLabel()
Definition: DividerTest.php:66
testRenderVertical()
Definition: DividerTest.php:79
Test on divider implementation.
Definition: DividerTest.php:30
$r