ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ChartScaleBarTest Class Reference

Test scale bar charts. More...

+ Inheritance diagram for ChartScaleBarTest:
+ Collaboration diagram for ChartScaleBarTest:

Public Member Functions

 test_implements_factory_interface ()
 
 test_get_items ()
 
 test_render ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Protected Member Functions

 getFactory ()
 

Detailed Description

Test scale bar charts.

Definition at line 14 of file ChartScaleBarTest.php.

Member Function Documentation

◆ getFactory()

ChartScaleBarTest::getFactory ( )
protected

Definition at line 16 of file ChartScaleBarTest.php.

Referenced by test_get_items(), test_implements_factory_interface(), and test_render().

17  {
18  return new I\Component\Chart\Factory(
19  $this->createMock(C\Chart\ProgressMeter\Factory::class)
20  );
21  }
+ Here is the caller graph for this function:

◆ test_get_items()

ChartScaleBarTest::test_get_items ( )

Definition at line 30 of file ChartScaleBarTest.php.

References $c, $f, and getFactory().

31  {
32  $f = $this->getFactory();
33 
34  $items = array(
35  "None" => false,
36  "Low" => false,
37  "Medium" => true,
38  "High" => false
39  );
40 
41  $c = $f->scaleBar($items);
42 
43  $this->assertEquals($c->getItems(), $items);
44  }
+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ChartScaleBarTest::test_implements_factory_interface ( )

Definition at line 23 of file ChartScaleBarTest.php.

References $f, and getFactory().

24  {
25  $f = $this->getFactory();
26 
27  $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ScaleBar", $f->scaleBar(array("1" => false)));
28  }
+ Here is the call graph for this function:

◆ test_render()

ChartScaleBarTest::test_render ( )

Definition at line 46 of file ChartScaleBarTest.php.

References $c, $f, $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

47  {
48  $f = $this->getFactory();
49  $r = $this->getDefaultRenderer();
50 
51  $items = array(
52  "None" => false,
53  "Low" => false,
54  "Medium" => true,
55  "High" => false
56  );
57 
58  $c = $f->scaleBar($items);
59 
60  $html = $r->render($c);
61 
62  $expected_html = <<<EOT
63 <ul class="il-chart-scale-bar">
64  <li style="width:25%">
65  <div class="il-chart-scale-bar-item ">
66  None
67  </div>
68  </li>
69  <li style="width:25%">
70  <div class="il-chart-scale-bar-item ">
71  Low
72  </div>
73  </li>
74  <li style="width:25%">
75  <div class="il-chart-scale-bar-item il-chart-scale-bar-active">
76  Medium <span class="sr-only">(active)</span>
77  </div>
78  </li>
79  <li style="width:25%">
80  <div class="il-chart-scale-bar-item ">
81  High
82  </div>
83  </li>
84 </ul>
85 EOT;
86 
87  $this->assertHTMLEquals($expected_html, $html);
88  }
"color:#CC0000 style
Definition: example_001.php:92
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

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