ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ChartScaleBarTest Class Reference

Test scale bar charts. More...

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

Public Member Functions

 testImplementsFactoryInterface ()
 
 testGetItems ()
 
 testRender ()
 

Protected Member Functions

 getFactory ()
 

Detailed Description

Test scale bar charts.

Definition at line 30 of file ChartScaleBarTest.php.

Member Function Documentation

◆ getFactory()

ChartScaleBarTest::getFactory ( )
protected

Definition at line 32 of file ChartScaleBarTest.php.

33 {
34 return new I\Component\Chart\Factory(
35 $this->createMock(I\Component\Chart\ProgressMeter\Factory::class),
36 $this->createMock(I\Component\Chart\Bar\Factory::class)
37 );
38 }

Referenced by testGetItems(), testImplementsFactoryInterface(), and testRender().

+ Here is the caller graph for this function:

◆ testGetItems()

ChartScaleBarTest::testGetItems ( )

Definition at line 47 of file ChartScaleBarTest.php.

47 : void
48 {
49 $f = $this->getFactory();
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 $this->assertEquals($c->getItems(), $items);
61 }
$c
Definition: deliver.php:25

References $c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

ChartScaleBarTest::testImplementsFactoryInterface ( )

Definition at line 40 of file ChartScaleBarTest.php.

40 : void
41 {
42 $f = $this->getFactory();
43
44 $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ScaleBar", $f->scaleBar(array("1" => false)));
45 }

References Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ testRender()

ChartScaleBarTest::testRender ( )

Definition at line 63 of file ChartScaleBarTest.php.

63 : void
64 {
65 $f = $this->getFactory();
66 $r = $this->getDefaultRenderer();
67
68 $items = array(
69 "None" => false,
70 "Low" => false,
71 "Medium" => true,
72 "High" => false
73 );
74
75 $c = $f->scaleBar($items);
76
77 $html = $r->render($c);
78
79 $expected_html = <<<EOT
80<ul class="il-chart-scale-bar">
81 <li style="width:25%">
82 <div class="il-chart-scale-bar-item ">
83 None
84 </div>
85 </li>
86 <li style="width:25%">
87 <div class="il-chart-scale-bar-item ">
88 Low
89 </div>
90 </li>
91 <li style="width:25%">
92 <div class="il-chart-scale-bar-item il-chart-scale-bar-active">
93 Medium <span class="sr-only">(active)</span>
94 </div>
95 </li>
96 <li style="width:25%">
97 <div class="il-chart-scale-bar-item ">
98 High
99 </div>
100 </li>
101</ul>
102EOT;
103
104 $this->assertHTMLEquals($expected_html, $html);
105 }

References $c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

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