ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DividerTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21require_once(__DIR__ . "/../../../../../../vendor/composer/vendor/autoload.php");
22require_once(__DIR__ . "/../../Base.php");
23
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}
Test on divider implementation.
Definition: DividerTest.php:31
testRenderHorizontalEmpty()
Definition: DividerTest.php:52
testRenderVertical()
Definition: DividerTest.php:79
testRenderHorizontalWithLabel()
Definition: DividerTest.php:66
testImplementsFactoryInterface()
Definition: DividerTest.php:37
Provides common functionality for UI tests.
Definition: Base.php:337
$c
Definition: deliver.php:25