1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the highcharts-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2017 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\HighchartsBundle\Tests\API\Chart\Series\Area; |
13
|
|
|
|
14
|
|
|
use PHPUnit_Framework_TestCase; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Highcharts data test. |
18
|
|
|
* |
19
|
|
|
* @author webeweb <https://github.com/webeweb/> |
20
|
|
|
* @package WBW\Bundle\HighchartsBundle\Tests\API\Chart\Series\Area |
21
|
|
|
* @version 5.0.14 |
22
|
|
|
*/ |
23
|
|
|
final class HighchartsDataTest extends PHPUnit_Framework_TestCase { |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Tests the __construct() method. |
27
|
|
|
* |
28
|
|
|
* @return void |
29
|
|
|
*/ |
30
|
|
|
public function testConstructor() { |
31
|
|
|
|
32
|
|
|
$obj1 = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\HighchartsData(true); |
33
|
|
|
|
34
|
|
|
$this->assertEquals(null, $obj1->getClassName()); |
35
|
|
|
$this->assertEquals(null, $obj1->getColor()); |
36
|
|
|
$this->assertEquals(null, $obj1->getColorIndex()); |
37
|
|
|
$this->assertEquals(null, $obj1->getDataLabels()); |
38
|
|
|
$this->assertEquals(null, $obj1->getDescription()); |
39
|
|
|
$this->assertEquals(null, $obj1->getDrilldown()); |
40
|
|
|
$this->assertEquals(null, $obj1->getEvents()); |
41
|
|
|
$this->assertEquals(null, $obj1->getId()); |
42
|
|
|
$this->assertEquals(null, $obj1->getLabelrank()); |
43
|
|
|
$this->assertEquals(null, $obj1->getMarker()); |
44
|
|
|
$this->assertEquals(null, $obj1->getName()); |
45
|
|
|
$this->assertEquals(null, $obj1->getSelected()); |
46
|
|
|
$this->assertEquals(null, $obj1->getX()); |
47
|
|
|
$this->assertEquals(null, $obj1->getY()); |
48
|
|
|
|
49
|
|
|
$obj0 = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\HighchartsData(false); |
50
|
|
|
|
51
|
|
|
$this->assertEquals(null, $obj0->getClassName()); |
52
|
|
|
$this->assertEquals(null, $obj0->getColor()); |
53
|
|
|
$this->assertEquals(null, $obj0->getColorIndex()); |
54
|
|
|
$this->assertEquals(null, $obj0->getDataLabels()); |
55
|
|
|
$this->assertEquals(null, $obj0->getDescription()); |
56
|
|
|
$this->assertEquals(null, $obj0->getDrilldown()); |
57
|
|
|
$this->assertEquals(null, $obj0->getEvents()); |
58
|
|
|
$this->assertEquals(null, $obj0->getId()); |
59
|
|
|
$this->assertEquals(null, $obj0->getLabelrank()); |
60
|
|
|
$this->assertEquals(null, $obj0->getMarker()); |
61
|
|
|
$this->assertEquals(null, $obj0->getName()); |
62
|
|
|
$this->assertEquals(false, $obj0->getSelected()); |
63
|
|
|
$this->assertEquals(null, $obj0->getX()); |
64
|
|
|
$this->assertEquals(null, $obj0->getY()); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Tests the clear() method. |
69
|
|
|
* |
70
|
|
|
* @return void |
71
|
|
|
*/ |
72
|
|
|
public function testClear() { |
73
|
|
|
|
74
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\HighchartsData(false); |
75
|
|
|
|
76
|
|
|
$obj->newEvents(); |
77
|
|
|
$obj->newMarker(); |
78
|
|
|
|
79
|
|
|
$obj->clear(); |
80
|
|
|
|
81
|
|
|
$res = ["events" => [], "marker" => []]; |
82
|
|
|
$this->assertEquals($res, $obj->toArray()); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Tests the jsonSerialize() method. |
87
|
|
|
* |
88
|
|
|
* @return void |
89
|
|
|
*/ |
90
|
|
|
public function testJsonSerialize() { |
91
|
|
|
|
92
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\HighchartsData(true); |
93
|
|
|
|
94
|
|
|
$this->assertEquals([], $obj->jsonSerialize()); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Tests the newEvents() method. |
99
|
|
|
* |
100
|
|
|
* @return void. |
101
|
|
|
*/ |
102
|
|
|
public function testNewEvents() { |
103
|
|
|
|
104
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\HighchartsData(false); |
105
|
|
|
|
106
|
|
|
$res = $obj->newEvents(); |
107
|
|
|
$this->assertInstanceOf(\WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\Data\HighchartsEvents::class, $res); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Tests the newMarker() method. |
112
|
|
|
* |
113
|
|
|
* @return void. |
114
|
|
|
*/ |
115
|
|
|
public function testNewMarker() { |
116
|
|
|
|
117
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\HighchartsData(false); |
118
|
|
|
|
119
|
|
|
$res = $obj->newMarker(); |
120
|
|
|
$this->assertInstanceOf(\WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\Data\HighchartsMarker::class, $res); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Tests the toArray() method. |
125
|
|
|
* |
126
|
|
|
* @return void |
127
|
|
|
*/ |
128
|
|
|
public function testToArray() { |
129
|
|
|
|
130
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\HighchartsData(true); |
131
|
|
|
|
132
|
|
|
$obj->setClassName("6f66e878c62db60568a3487869695820"); |
133
|
|
|
|
134
|
|
|
$res1 = ["className" => "6f66e878c62db60568a3487869695820"]; |
135
|
|
|
$this->assertEquals($res1, $obj->toArray()); |
136
|
|
|
|
137
|
|
|
$obj->setColor("70dda5dfb8053dc6d1c492574bce9bfd"); |
138
|
|
|
|
139
|
|
|
$res2 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd"]; |
140
|
|
|
$this->assertEquals($res2, $obj->toArray()); |
141
|
|
|
|
142
|
|
|
$obj->setColorIndex(66); |
143
|
|
|
|
144
|
|
|
$res3 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66]; |
145
|
|
|
$this->assertEquals($res3, $obj->toArray()); |
146
|
|
|
|
147
|
|
|
$obj->setDataLabels(["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"]); |
148
|
|
|
|
149
|
|
|
$res4 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"]]; |
150
|
|
|
$this->assertEquals($res4, $obj->toArray()); |
151
|
|
|
|
152
|
|
|
$obj->setDescription("67daf92c833c41c95db874e18fcb2786"); |
153
|
|
|
|
154
|
|
|
$res5 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"], "description" => "67daf92c833c41c95db874e18fcb2786"]; |
155
|
|
|
$this->assertEquals($res5, $obj->toArray()); |
156
|
|
|
|
157
|
|
|
$obj->setDrilldown("e3fd48c72943315f737d8a814fda4fd1"); |
158
|
|
|
|
159
|
|
|
$res6 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"], "description" => "67daf92c833c41c95db874e18fcb2786", "drilldown" => "e3fd48c72943315f737d8a814fda4fd1"]; |
160
|
|
|
$this->assertEquals($res6, $obj->toArray()); |
161
|
|
|
|
162
|
|
|
$obj->setEvents(new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\Data\HighchartsEvents()); |
163
|
|
|
|
164
|
|
|
$res7 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"], "description" => "67daf92c833c41c95db874e18fcb2786", "drilldown" => "e3fd48c72943315f737d8a814fda4fd1", "events" => []]; |
165
|
|
|
$this->assertEquals($res7, $obj->toArray()); |
166
|
|
|
|
167
|
|
|
$obj->setId("b80bb7740288fda1f201890375a60c8f"); |
168
|
|
|
|
169
|
|
|
$res8 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"], "description" => "67daf92c833c41c95db874e18fcb2786", "drilldown" => "e3fd48c72943315f737d8a814fda4fd1", "events" => [], "id" => "b80bb7740288fda1f201890375a60c8f"]; |
170
|
|
|
$this->assertEquals($res8, $obj->toArray()); |
171
|
|
|
|
172
|
|
|
$obj->setLabelrank(34); |
173
|
|
|
|
174
|
|
|
$res9 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"], "description" => "67daf92c833c41c95db874e18fcb2786", "drilldown" => "e3fd48c72943315f737d8a814fda4fd1", "events" => [], "id" => "b80bb7740288fda1f201890375a60c8f", "labelrank" => 34]; |
175
|
|
|
$this->assertEquals($res9, $obj->toArray()); |
176
|
|
|
|
177
|
|
|
$obj->setMarker(new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Area\Data\HighchartsMarker()); |
178
|
|
|
|
179
|
|
|
$res10 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"], "description" => "67daf92c833c41c95db874e18fcb2786", "drilldown" => "e3fd48c72943315f737d8a814fda4fd1", "events" => [], "id" => "b80bb7740288fda1f201890375a60c8f", "labelrank" => 34, "marker" => []]; |
180
|
|
|
$this->assertEquals($res10, $obj->toArray()); |
181
|
|
|
|
182
|
|
|
$obj->setName("b068931cc450442b63f5b3d276ea4297"); |
183
|
|
|
|
184
|
|
|
$res11 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"], "description" => "67daf92c833c41c95db874e18fcb2786", "drilldown" => "e3fd48c72943315f737d8a814fda4fd1", "events" => [], "id" => "b80bb7740288fda1f201890375a60c8f", "labelrank" => 34, "marker" => [], "name" => "b068931cc450442b63f5b3d276ea4297"]; |
185
|
|
|
$this->assertEquals($res11, $obj->toArray()); |
186
|
|
|
|
187
|
|
|
$obj->setSelected(0); |
188
|
|
|
|
189
|
|
|
$res12 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"], "description" => "67daf92c833c41c95db874e18fcb2786", "drilldown" => "e3fd48c72943315f737d8a814fda4fd1", "events" => [], "id" => "b80bb7740288fda1f201890375a60c8f", "labelrank" => 34, "marker" => [], "name" => "b068931cc450442b63f5b3d276ea4297", "selected" => 0]; |
190
|
|
|
$this->assertEquals($res12, $obj->toArray()); |
191
|
|
|
|
192
|
|
|
$obj->setX(72); |
193
|
|
|
|
194
|
|
|
$res13 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"], "description" => "67daf92c833c41c95db874e18fcb2786", "drilldown" => "e3fd48c72943315f737d8a814fda4fd1", "events" => [], "id" => "b80bb7740288fda1f201890375a60c8f", "labelrank" => 34, "marker" => [], "name" => "b068931cc450442b63f5b3d276ea4297", "selected" => 0, "x" => 72]; |
195
|
|
|
$this->assertEquals($res13, $obj->toArray()); |
196
|
|
|
|
197
|
|
|
$obj->setY(64); |
198
|
|
|
|
199
|
|
|
$res14 = ["className" => "6f66e878c62db60568a3487869695820", "color" => "70dda5dfb8053dc6d1c492574bce9bfd", "colorIndex" => 66, "dataLabels" => ["dataLabels" => "d4d108fe6659fac79420fa083ef3adf2"], "description" => "67daf92c833c41c95db874e18fcb2786", "drilldown" => "e3fd48c72943315f737d8a814fda4fd1", "events" => [], "id" => "b80bb7740288fda1f201890375a60c8f", "labelrank" => 34, "marker" => [], "name" => "b068931cc450442b63f5b3d276ea4297", "selected" => 0, "x" => 72, "y" => 64]; |
200
|
|
|
$this->assertEquals($res14, $obj->toArray()); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
} |
204
|
|
|
|