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

HighchartsMarkerTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 122
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 122
rs 10
c 0
b 0
f 0
wmc 5
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\Bubble;
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\Bubble
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\Bubble\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->getStates());
40
        $this->assertEquals(null, $obj1->getSymbol());
41
        $this->assertEquals(null, $obj1->getWidth());
42
43
        $obj0 = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Bubble\HighchartsMarker(false);
44
45
        $this->assertEquals(null, $obj0->getEnabled());
46
        $this->assertEquals(null, $obj0->getFillColor());
47
        $this->assertEquals(null, $obj0->getHeight());
48
        $this->assertEquals("#ffffff", $obj0->getLineColor());
49
        $this->assertEquals(0, $obj0->getLineWidth());
50
        $this->assertEquals(null, $obj0->getStates());
51
        $this->assertEquals("circle", $obj0->getSymbol());
52
        $this->assertEquals(null, $obj0->getWidth());
53
    }
54
55
    /**
56
     * Tests the clear() method.
57
     *
58
     * @return void
59
     */
60
    public function testClear() {
61
62
        $obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Bubble\HighchartsMarker(false);
63
64
        $obj->newStates();
65
66
        $obj->clear();
67
68
        $res = ["states" => []];
69
        $this->assertEquals($res, $obj->toArray());
70
    }
71
72
    /**
73
     * Tests the jsonSerialize() method.
74
     *
75
     * @return void
76
     */
77
    public function testJsonSerialize() {
78
79
        $obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Bubble\HighchartsMarker(true);
80
81
        $this->assertEquals([], $obj->jsonSerialize());
82
    }
83
84
    /**
85
     * Tests the newStates() method.
86
     *
87
     * @return void.
88
     */
89
    public function testNewStates() {
90
91
        $obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Bubble\HighchartsMarker(false);
92
93
        $res = $obj->newStates();
94
        $this->assertInstanceOf(\WBW\Bundle\HighchartsBundle\API\Chart\Series\Bubble\Marker\HighchartsStates::class, $res);
95
    }
96
97
    /**
98
     * Tests the toArray() method.
99
     *
100
     * @return void
101
     */
102
    public function testToArray() {
103
104
        $obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Bubble\HighchartsMarker(true);
105
106
        $obj->setEnabled(0);
107
108
        $res1 = ["enabled" => 0];
109
        $this->assertEquals($res1, $obj->toArray());
110
111
        $obj->setFillColor("1fde055d3ff900e04ca08bc82066d7fd");
112
113
        $res2 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd"];
114
        $this->assertEquals($res2, $obj->toArray());
115
116
        $obj->setHeight(48);
117
118
        $res3 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 48];
119
        $this->assertEquals($res3, $obj->toArray());
120
121
        $obj->setLineColor("c2580eebfdbdb9fc629f50cc147c3f63");
122
123
        $res4 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 48, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63"];
124
        $this->assertEquals($res4, $obj->toArray());
125
126
        $obj->setLineWidth(42);
127
128
        $res5 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 48, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63", "lineWidth" => 42];
129
        $this->assertEquals($res5, $obj->toArray());
130
131
        $obj->setStates(new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Bubble\Marker\HighchartsStates());
132
133
        $res6 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 48, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63", "lineWidth" => 42, "states" => []];
134
        $this->assertEquals($res6, $obj->toArray());
135
136
        $obj->setSymbol("triangle-down");
137
138
        $res7 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 48, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63", "lineWidth" => 42, "states" => [], "symbol" => "triangle-down"];
139
        $this->assertEquals($res7, $obj->toArray());
140
141
        $obj->setWidth(15);
142
143
        $res8 = ["enabled" => 0, "fillColor" => "1fde055d3ff900e04ca08bc82066d7fd", "height" => 48, "lineColor" => "c2580eebfdbdb9fc629f50cc147c3f63", "lineWidth" => 42, "states" => [], "symbol" => "triangle-down", "width" => 15];
144
        $this->assertEquals($res8, $obj->toArray());
145
    }
146
147
}
148