|
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\XAxis\PlotLines; |
|
13
|
|
|
|
|
14
|
|
|
use PHPUnit_Framework_TestCase; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Highcharts label test. |
|
18
|
|
|
* |
|
19
|
|
|
* @author webeweb <https://github.com/webeweb/> |
|
20
|
|
|
* @package WBW\Bundle\HighchartsBundle\Tests\API\Chart\XAxis\PlotLines |
|
21
|
|
|
* @version 5.0.14 |
|
22
|
|
|
*/ |
|
23
|
|
|
final class HighchartsLabelTest 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\XAxis\PlotLines\HighchartsLabel(true); |
|
33
|
|
|
|
|
34
|
|
|
$this->assertEquals(null, $obj1->getAlign()); |
|
35
|
|
|
$this->assertEquals(null, $obj1->getRotation()); |
|
36
|
|
|
$this->assertEquals(null, $obj1->getStyle()); |
|
37
|
|
|
$this->assertEquals(null, $obj1->getText()); |
|
38
|
|
|
$this->assertEquals(null, $obj1->getTextAlign()); |
|
39
|
|
|
$this->assertEquals(null, $obj1->getUseHTML()); |
|
40
|
|
|
$this->assertEquals(null, $obj1->getVerticalAlign()); |
|
41
|
|
|
$this->assertEquals(null, $obj1->getX()); |
|
42
|
|
|
$this->assertEquals(null, $obj1->getY()); |
|
43
|
|
|
|
|
44
|
|
|
$obj0 = new \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\PlotLines\HighchartsLabel(false); |
|
45
|
|
|
|
|
46
|
|
|
$this->assertEquals("left", $obj0->getAlign()); |
|
47
|
|
|
$this->assertEquals(null, $obj0->getRotation()); |
|
48
|
|
|
$this->assertEquals(null, $obj0->getStyle()); |
|
49
|
|
|
$this->assertEquals(null, $obj0->getText()); |
|
50
|
|
|
$this->assertEquals(null, $obj0->getTextAlign()); |
|
51
|
|
|
$this->assertEquals(false, $obj0->getUseHTML()); |
|
52
|
|
|
$this->assertEquals("top", $obj0->getVerticalAlign()); |
|
53
|
|
|
$this->assertEquals(null, $obj0->getX()); |
|
54
|
|
|
$this->assertEquals(null, $obj0->getY()); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Tests the jsonSerialize() method. |
|
59
|
|
|
* |
|
60
|
|
|
* @return void |
|
61
|
|
|
*/ |
|
62
|
|
|
public function testJsonSerialize() { |
|
63
|
|
|
|
|
64
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\PlotLines\HighchartsLabel(true); |
|
65
|
|
|
|
|
66
|
|
|
$this->assertEquals([], $obj->jsonSerialize()); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Tests the toArray() method. |
|
71
|
|
|
* |
|
72
|
|
|
* @return void |
|
73
|
|
|
*/ |
|
74
|
|
|
public function testToArray() { |
|
75
|
|
|
|
|
76
|
|
|
$obj = new \WBW\Bundle\HighchartsBundle\API\Chart\XAxis\PlotLines\HighchartsLabel(true); |
|
77
|
|
|
|
|
78
|
|
|
$obj->setAlign("f792d1afb0399dce47533bead9d71a8a"); |
|
79
|
|
|
|
|
80
|
|
|
$res1 = ["align" => "f792d1afb0399dce47533bead9d71a8a"]; |
|
81
|
|
|
$this->assertEquals($res1, $obj->toArray()); |
|
82
|
|
|
|
|
83
|
|
|
$obj->setRotation(48); |
|
84
|
|
|
|
|
85
|
|
|
$res2 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 48]; |
|
86
|
|
|
$this->assertEquals($res2, $obj->toArray()); |
|
87
|
|
|
|
|
88
|
|
|
$obj->setStyle(["style" => "a1b01e734b573fca08eb1a65e6df9a38"]); |
|
89
|
|
|
|
|
90
|
|
|
$res3 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 48, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"]]; |
|
91
|
|
|
$this->assertEquals($res3, $obj->toArray()); |
|
92
|
|
|
|
|
93
|
|
|
$obj->setText("1cb251ec0d568de6a929b520c4aed8d1"); |
|
94
|
|
|
|
|
95
|
|
|
$res4 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 48, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1"]; |
|
96
|
|
|
$this->assertEquals($res4, $obj->toArray()); |
|
97
|
|
|
|
|
98
|
|
|
$obj->setTextAlign("6e1fcbf7c065b2e7fef4cdc9bae3fe53"); |
|
99
|
|
|
|
|
100
|
|
|
$res5 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 48, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1", "textAlign" => "6e1fcbf7c065b2e7fef4cdc9bae3fe53"]; |
|
101
|
|
|
$this->assertEquals($res5, $obj->toArray()); |
|
102
|
|
|
|
|
103
|
|
|
$obj->setUseHTML(1); |
|
104
|
|
|
|
|
105
|
|
|
$res6 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 48, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1", "textAlign" => "6e1fcbf7c065b2e7fef4cdc9bae3fe53", "useHTML" => 1]; |
|
106
|
|
|
$this->assertEquals($res6, $obj->toArray()); |
|
107
|
|
|
|
|
108
|
|
|
$obj->setVerticalAlign("bottom"); |
|
109
|
|
|
|
|
110
|
|
|
$res7 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 48, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1", "textAlign" => "6e1fcbf7c065b2e7fef4cdc9bae3fe53", "useHTML" => 1, "verticalAlign" => "bottom"]; |
|
111
|
|
|
$this->assertEquals($res7, $obj->toArray()); |
|
112
|
|
|
|
|
113
|
|
|
$obj->setX(68); |
|
114
|
|
|
|
|
115
|
|
|
$res8 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 48, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1", "textAlign" => "6e1fcbf7c065b2e7fef4cdc9bae3fe53", "useHTML" => 1, "verticalAlign" => "bottom", "x" => 68]; |
|
116
|
|
|
$this->assertEquals($res8, $obj->toArray()); |
|
117
|
|
|
|
|
118
|
|
|
$obj->setY(37); |
|
119
|
|
|
|
|
120
|
|
|
$res9 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 48, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1", "textAlign" => "6e1fcbf7c065b2e7fef4cdc9bae3fe53", "useHTML" => 1, "verticalAlign" => "bottom", "x" => 68, "y" => 37]; |
|
121
|
|
|
$this->assertEquals($res9, $obj->toArray()); |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
} |
|
125
|
|
|
|