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\Polygon\Data; |
13
|
|
|
|
14
|
|
|
use PHPUnit_Framework_TestCase; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Highcharts marker test. |
18
|
|
|
* |
19
|
|
|
* @author webeweb <https://github.com/webeweb/> |
20
|
|
|
* @package WBW\Bundle\HighchartsBundle\Tests\API\Chart\Series\Polygon\Data |
21
|
|
|
* @version 5.0.14 |
22
|
|
|
*/ |
23
|
|
|
final class HighchartsMarkerTest 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\Polygon\Data\HighchartsMarker(true); |
33
|
|
|
|
34
|
|
|
$this->assertEquals(null, $obj1->getEnabled()); |
35
|
|
|
$this->assertEquals(null, $obj1->getFillColor()); |
36
|
|
|
$this->assertEquals(null, $obj1->getHeight()); |
37
|
|
|
$this->assertEquals(null, $obj1->getLineColor()); |
38
|
|
|
$this->assertEquals(null, $obj1->getLineWidth()); |
39
|
|
|
$this->assertEquals(null, $obj1->getRadius()); |
40
|
|
|
$this->assertEquals(null, $obj1->getStates()); |
41
|
|
|
$this->assertEquals(null, $obj1->getSymbol()); |
42
|
|
|
$this->assertEquals(null, $obj1->getWidth()); |
43
|
|
|
|
44
|
|
|
$obj0 = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Polygon\Data\HighchartsMarker(false); |
45
|
|
|
|
46
|
|
|
$this->assertEquals(null, $obj0->getEnabled()); |
47
|
|
|
$this->assertEquals(null, $obj0->getFillColor()); |
48
|
|
|
$this->assertEquals(null, $obj0->getHeight()); |
49
|
|
|
$this->assertEquals("#ffffff", $obj0->getLineColor()); |
50
|
|
|
$this->assertEquals(0, $obj0->getLineWidth()); |
51
|
|
|
$this->assertEquals(4, $obj0->getRadius()); |
52
|
|
|
$this->assertEquals(null, $obj0->getStates()); |
53
|
|
|
$this->assertEquals(null, $obj0->getSymbol()); |
54
|
|
|
$this->assertEquals(null, $obj0->getWidth()); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Tests the clear() method. |
59
|
|
|
* |
60
|
|
|
* @return void |
61
|
|
|
*/ |
62
|
|
|
public function testClear() { |
63
|
|
|
|
64
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Polygon\Data\HighchartsMarker(false); |
65
|
|
|
|
66
|
|
|
$obj->newStates(); |
67
|
|
|
|
68
|
|
|
$obj->clear(); |
69
|
|
|
|
70
|
|
|
$res = ["states" => []]; |
71
|
|
|
$this->assertEquals($res, $obj->toArray()); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Tests the jsonSerialize() method. |
76
|
|
|
* |
77
|
|
|
* @return void |
78
|
|
|
*/ |
79
|
|
|
public function testJsonSerialize() { |
80
|
|
|
|
81
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Polygon\Data\HighchartsMarker(true); |
82
|
|
|
|
83
|
|
|
$this->assertEquals([], $obj->jsonSerialize()); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Tests the newStates() method. |
88
|
|
|
* |
89
|
|
|
* @return void. |
90
|
|
|
*/ |
91
|
|
|
public function testNewStates() { |
92
|
|
|
|
93
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Polygon\Data\HighchartsMarker(false); |
94
|
|
|
|
95
|
|
|
$res = $obj->newStates(); |
96
|
|
|
$this->assertInstanceOf(\WBW\Bundle\HighchartsBundle\API\Chart\Series\Polygon\Data\Marker\HighchartsStates::class, $res); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Tests the toArray() method. |
101
|
|
|
* |
102
|
|
|
* @return void |
103
|
|
|
*/ |
104
|
|
|
public function testToArray() { |
105
|
|
|
|
106
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Polygon\Data\HighchartsMarker(true); |
107
|
|
|
|
108
|
|
|
$obj->setEnabled(0); |
109
|
|
|
|
110
|
|
|
$res1 = ["enabled" => 0]; |
111
|
|
|
$this->assertEquals($res1, $obj->toArray()); |
112
|
|
|
|
113
|
|
|
$obj->setFillColor("1fde055d3ff900e04ca08bc82066d7fd"); |
114
|
|
|
|
115
|
|
|
$res2 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd"]; |
116
|
|
|
$this->assertEquals($res2, $obj->toArray()); |
117
|
|
|
|
118
|
|
|
$obj->setHeight(20); |
119
|
|
|
|
120
|
|
|
$res3 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 20]; |
121
|
|
|
$this->assertEquals($res3, $obj->toArray()); |
122
|
|
|
|
123
|
|
|
$obj->setLineColor("c2580eebfdbdb9fc629f50cc147c3f63"); |
124
|
|
|
|
125
|
|
|
$res4 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 20, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63"]; |
126
|
|
|
$this->assertEquals($res4, $obj->toArray()); |
127
|
|
|
|
128
|
|
|
$obj->setLineWidth(20); |
129
|
|
|
|
130
|
|
|
$res5 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 20, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63", "lineWidth" => 20]; |
131
|
|
|
$this->assertEquals($res5, $obj->toArray()); |
132
|
|
|
|
133
|
|
|
$obj->setRadius(44); |
134
|
|
|
|
135
|
|
|
$res6 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 20, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63", "lineWidth" => 20, "radius" => 44]; |
136
|
|
|
$this->assertEquals($res6, $obj->toArray()); |
137
|
|
|
|
138
|
|
|
$obj->setStates(new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Polygon\Data\Marker\HighchartsStates()); |
139
|
|
|
|
140
|
|
|
$res7 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 20, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63", "lineWidth" => 20, "radius" => 44, "states" => []]; |
141
|
|
|
$this->assertEquals($res7, $obj->toArray()); |
142
|
|
|
|
143
|
|
|
$obj->setSymbol("triangle-down"); |
144
|
|
|
|
145
|
|
|
$res8 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 20, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63", "lineWidth" => 20, "radius" => 44, "states" => [], "symbol" => "triangle-down"]; |
146
|
|
|
$this->assertEquals($res8, $obj->toArray()); |
147
|
|
|
|
148
|
|
|
$obj->setWidth(81); |
149
|
|
|
|
150
|
|
|
$res9 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 20, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63", "lineWidth" => 20, "radius" => 44, "states" => [], "symbol" => "triangle-down", "width" => 81]; |
151
|
|
|
$this->assertEquals($res9, $obj->toArray()); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
} |
155
|
|
|
|