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\Column\States; |
13
|
|
|
|
14
|
|
|
use PHPUnit_Framework_TestCase; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Highcharts hover test. |
18
|
|
|
* |
19
|
|
|
* @author webeweb <https://github.com/webeweb/> |
20
|
|
|
* @package WBW\Bundle\HighchartsBundle\Tests\API\Chart\Series\Column\States |
21
|
|
|
* @version 5.0.14 |
22
|
|
|
*/ |
23
|
|
|
final class HighchartsHoverTest 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\Column\States\HighchartsHover(true); |
33
|
|
|
|
34
|
|
|
$this->assertEquals(null, $obj1->getAnimation()); |
35
|
|
|
$this->assertEquals(null, $obj1->getEnabled()); |
36
|
|
|
$this->assertEquals(null, $obj1->getHalo()); |
37
|
|
|
$this->assertEquals(null, $obj1->getLineWidth()); |
38
|
|
|
$this->assertEquals(null, $obj1->getLineWidthPlus()); |
39
|
|
|
$this->assertEquals(null, $obj1->getMarker()); |
40
|
|
|
|
41
|
|
|
$obj0 = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Column\States\HighchartsHover(false); |
42
|
|
|
|
43
|
|
|
$this->assertEquals(["duration" => 50], $obj0->getAnimation()); |
44
|
|
|
$this->assertEquals(true, $obj0->getEnabled()); |
45
|
|
|
$this->assertEquals(null, $obj0->getHalo()); |
46
|
|
|
$this->assertEquals(2, $obj0->getLineWidth()); |
47
|
|
|
$this->assertEquals(1, $obj0->getLineWidthPlus()); |
48
|
|
|
$this->assertEquals(null, $obj0->getMarker()); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Tests the clear() method. |
53
|
|
|
* |
54
|
|
|
* @return void |
55
|
|
|
*/ |
56
|
|
|
public function testClear() { |
57
|
|
|
|
58
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Column\States\HighchartsHover(false); |
59
|
|
|
|
60
|
|
|
$obj->newMarker(); |
61
|
|
|
|
62
|
|
|
$obj->clear(); |
63
|
|
|
|
64
|
|
|
$res = ["marker" => []]; |
65
|
|
|
$this->assertEquals($res, $obj->toArray()); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Tests the jsonSerialize() method. |
70
|
|
|
* |
71
|
|
|
* @return void |
72
|
|
|
*/ |
73
|
|
|
public function testJsonSerialize() { |
74
|
|
|
|
75
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Column\States\HighchartsHover(true); |
76
|
|
|
|
77
|
|
|
$this->assertEquals([], $obj->jsonSerialize()); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Tests the newMarker() method. |
82
|
|
|
* |
83
|
|
|
* @return void. |
84
|
|
|
*/ |
85
|
|
|
public function testNewMarker() { |
86
|
|
|
|
87
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Column\States\HighchartsHover(false); |
88
|
|
|
|
89
|
|
|
$res = $obj->newMarker(); |
90
|
|
|
$this->assertInstanceOf(\WBW\Bundle\HighchartsBundle\API\Chart\Series\Column\States\Hover\HighchartsMarker::class, $res); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Tests the toArray() method. |
95
|
|
|
* |
96
|
|
|
* @return void |
97
|
|
|
*/ |
98
|
|
|
public function testToArray() { |
99
|
|
|
|
100
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Column\States\HighchartsHover(true); |
101
|
|
|
|
102
|
|
|
$obj->setAnimation(0); |
103
|
|
|
|
104
|
|
|
$res1 = ["animation" => 0]; |
105
|
|
|
$this->assertEquals($res1, $obj->toArray()); |
106
|
|
|
|
107
|
|
|
$obj->setEnabled(0); |
108
|
|
|
|
109
|
|
|
$res2 = ["animation" => 0, "enabled" => 0]; |
110
|
|
|
$this->assertEquals($res2, $obj->toArray()); |
111
|
|
|
|
112
|
|
|
$obj->setHalo(["halo" => "57f842286171094855e51fc3a541c1e2"]); |
113
|
|
|
|
114
|
|
|
$res3 = ["animation" => 0, "enabled" => 0, "halo" => ["halo" => "57f842286171094855e51fc3a541c1e2"]]; |
115
|
|
|
$this->assertEquals($res3, $obj->toArray()); |
116
|
|
|
|
117
|
|
|
$obj->setLineWidth(4); |
118
|
|
|
|
119
|
|
|
$res4 = ["animation" => 0, "enabled" => 0, "halo" => ["halo" => "57f842286171094855e51fc3a541c1e2"], "lineWidth" => 4]; |
120
|
|
|
$this->assertEquals($res4, $obj->toArray()); |
121
|
|
|
|
122
|
|
|
$obj->setLineWidthPlus(11); |
123
|
|
|
|
124
|
|
|
$res5 = ["animation" => 0, "enabled" => 0, "halo" => ["halo" => "57f842286171094855e51fc3a541c1e2"], "lineWidth" => 4, "lineWidthPlus" => 11]; |
125
|
|
|
$this->assertEquals($res5, $obj->toArray()); |
126
|
|
|
|
127
|
|
|
$obj->setMarker(new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Column\States\Hover\HighchartsMarker()); |
128
|
|
|
|
129
|
|
|
$res6 = ["animation" => 0, "enabled" => 0, "halo" => ["halo" => "57f842286171094855e51fc3a541c1e2"], "lineWidth" => 4, "lineWidthPlus" => 11, "marker" => []]; |
130
|
|
|
$this->assertEquals($res6, $obj->toArray()); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
} |
134
|
|
|
|