ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DividerTest.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2017 Alex Killing <killing@leifos.de> Extended GPL, see docs/LICENSE */
4
5require_once(__DIR__ . "/../../../../libs/composer/vendor/autoload.php");
6require_once(__DIR__ . "/../../Base.php");
7
8use \ILIAS\UI\Component as C;
9use \ILIAS\UI\Implementation as I;
10
15{
16 protected function getFactory()
17 {
18 return new I\Component\Divider\Factory();
19 }
20
22 {
23 $f = $this->getFactory();
24
25 $this->assertInstanceOf("ILIAS\\UI\\Component\\Divider\\Horizontal", $f->horizontal());
26 }
27
28 public function test_with_label()
29 {
30 $f = $this->getFactory();
31 $c = $f->horizontal()->withLabel("label");
32
33 $this->assertEquals($c->getLabel(), "label");
34 }
35
37 {
38 $f = $this->getFactory();
39 $r = $this->getDefaultRenderer();
40
41 $c = $f->horizontal();
42
43 $html = trim($r->render($c));
44
45 $expected_html = "<hr/>";
46
47 $this->assertHTMLEquals($expected_html, $html);
48 }
49
51 {
52 $f = $this->getFactory();
53 $r = $this->getDefaultRenderer();
54
55 $c = $f->horizontal()->withLabel("label");
56
57 $html = trim($r->render($c));
58 $expected_html = '<hr class="il-divider-with-label" /><h6 class="il-divider">label</h6>';
59
60 $this->assertHTMLEquals("<div>" . $expected_html . "</div>", "<div>" . $html . "</div>");
61 }
62
63 public function test_render_vertical()
64 {
65 $f = $this->getFactory();
66 $r = $this->getDefaultRenderer();
67
68 $c = $f->vertical();
69
70 $html = trim($r->render($c));
71 $expected_html = '<span class="glyphicon il-divider-vertical" aria-hidden="true"></span>';
72
73 $this->assertHTMLEquals("<div>" . $expected_html . "</div>", "<div>" . $html . "</div>");
74 }
75}
An exception for terminatinating execution or to throw for unit testing.
Test on divider implementation.
Definition: DividerTest.php:15
test_implements_factory_interface()
Definition: DividerTest.php:21
test_render_horizontal_with_label()
Definition: DividerTest.php:50
test_render_horizontal_empty()
Definition: DividerTest.php:36
test_render_vertical()
Definition: DividerTest.php:63
Provides common functionality for UI tests.
Definition: Base.php:192
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79