Passed
Push — master ( 802754...f898ad )
by WEBEWEB
07:59 queued 25s
created

HighchartsLabelTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 99
rs 10
c 0
b 0
f 0
wmc 3
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\YAxis\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\YAxis\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\YAxis\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\YAxis\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\YAxis\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\YAxis\PlotLines\HighchartsLabel(true);
77
78
        $obj->setAlign("f792d1afb0399dce47533bead9d71a8a");
79
80
        $res1 = ["align" => "f792d1afb0399dce47533bead9d71a8a"];
81
        $this->assertEquals($res1, $obj->toArray());
82
83
        $obj->setRotation(54);
84
85
        $res2 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 54];
86
        $this->assertEquals($res2, $obj->toArray());
87
88
        $obj->setStyle(["style" => "a1b01e734b573fca08eb1a65e6df9a38"]);
89
90
        $res3 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 54, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"]];
91
        $this->assertEquals($res3, $obj->toArray());
92
93
        $obj->setText("1cb251ec0d568de6a929b520c4aed8d1");
94
95
        $res4 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 54, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1"];
96
        $this->assertEquals($res4, $obj->toArray());
97
98
        $obj->setTextAlign("6e1fcbf7c065b2e7fef4cdc9bae3fe53");
99
100
        $res5 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 54, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1", "textAlign" => "6e1fcbf7c065b2e7fef4cdc9bae3fe53"];
101
        $this->assertEquals($res5, $obj->toArray());
102
103
        $obj->setUseHTML(1);
104
105
        $res6 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 54, "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" => 54, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1", "textAlign" => "6e1fcbf7c065b2e7fef4cdc9bae3fe53", "useHTML" => 1, "verticalAlign" => "bottom"];
111
        $this->assertEquals($res7, $obj->toArray());
112
113
        $obj->setX(22);
114
115
        $res8 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 54, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1", "textAlign" => "6e1fcbf7c065b2e7fef4cdc9bae3fe53", "useHTML" => 1, "verticalAlign" => "bottom", "x" => 22];
116
        $this->assertEquals($res8, $obj->toArray());
117
118
        $obj->setY(88);
119
120
        $res9 = ["align" => "f792d1afb0399dce47533bead9d71a8a", "rotation" => 54, "style" => ["style" => "a1b01e734b573fca08eb1a65e6df9a38"], "text" => "1cb251ec0d568de6a929b520c4aed8d1", "textAlign" => "6e1fcbf7c065b2e7fef4cdc9bae3fe53", "useHTML" => 1, "verticalAlign" => "bottom", "x" => 22, "y" => 88];
121
        $this->assertEquals($res9, $obj->toArray());
122
    }
123
124
}
125