ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ChartScaleBarTest.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;
9
14{
15
19 public function getFactory()
20 {
21 return new \ILIAS\UI\Implementation\Factory();
22 }
23
25 {
26 $f = $this->getFactory();
27
28 $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ScaleBar", $f->chart()->scaleBar(array("1" => false)));
29 }
30
31 public function test_get_items()
32 {
33 $f = $this->getFactory();
34
35 $items = array(
36 "None" => false,
37 "Low" => false,
38 "Medium" => true,
39 "High" => false
40 );
41
42 $c = $f->chart()->scaleBar($items);
43
44 $this->assertEquals($c->getItems(), $items);
45 }
46
47 public function test_render()
48 {
49 $f = $this->getFactory();
50 $r = $this->getDefaultRenderer();
51
52 $items = array(
53 "None" => false,
54 "Low" => false,
55 "Medium" => true,
56 "High" => false
57 );
58
59 $c = $f->chart()->scaleBar($items);
60
61 $html = $r->render($c);
62
63 $expected_html = <<<EOT
64<ul class="il-chart-scale-bar">
65 <li style="width:25%">
66 <div class="il-chart-scale-bar-item ">
67 None
68 </div>
69 </li>
70 <li style="width:25%">
71 <div class="il-chart-scale-bar-item ">
72 Low
73 </div>
74 </li>
75 <li style="width:25%">
76 <div class="il-chart-scale-bar-item il-chart-scale-bar-active">
77 Medium <span class="sr-only">(active)</span>
78 </div>
79 </li>
80 <li style="width:25%">
81 <div class="il-chart-scale-bar-item ">
82 High
83 </div>
84 </li>
85</ul>
86EOT;
87
88 $this->assertHTMLEquals($expected_html, $html);
89 }
90}
An exception for terminatinating execution or to throw for unit testing.
Test scale bar charts.
Provides common functionality for UI tests.
Definition: Base.php:178
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79