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

HighchartsTooltipTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 134
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 134
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\PlotOptions\Series;
13
14
use PHPUnit_Framework_TestCase;
15
16
/**
17
 * Highcharts tooltip test.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Bundle\HighchartsBundle\Tests\API\Chart\PlotOptions\Series
21
 * @version 5.0.14
22
 */
23
final class HighchartsTooltipTest 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\PlotOptions\Series\HighchartsTooltip(true);
33
34
        $this->assertEquals(null, $obj1->getDateTimeLabelFormats());
35
        $this->assertEquals(null, $obj1->getFollowPointer());
36
        $this->assertEquals(null, $obj1->getFollowTouchMove());
37
        $this->assertEquals(null, $obj1->getFooterFormat());
38
        $this->assertEquals(null, $obj1->getHeaderFormat());
39
        $this->assertEquals(null, $obj1->getHideDelay());
40
        $this->assertEquals(null, $obj1->getPadding());
41
        $this->assertEquals(null, $obj1->getPointFormat());
42
        $this->assertEquals(null, $obj1->getPointFormatter());
43
        $this->assertEquals(null, $obj1->getSplit());
44
        $this->assertEquals(null, $obj1->getValueDecimals());
45
        $this->assertEquals(null, $obj1->getValuePrefix());
46
        $this->assertEquals(null, $obj1->getValueSuffix());
47
        $this->assertEquals(null, $obj1->getXDateFormat());
48
49
        $obj0 = new \WBW\Bundle\HighchartsBundle\API\Chart\PlotOptions\Series\HighchartsTooltip(false);
50
51
        $this->assertEquals(null, $obj0->getDateTimeLabelFormats());
52
        $this->assertEquals(false, $obj0->getFollowPointer());
53
        $this->assertEquals(true, $obj0->getFollowTouchMove());
54
        $this->assertEquals("false", $obj0->getFooterFormat());
55
        $this->assertEquals(null, $obj0->getHeaderFormat());
56
        $this->assertEquals(500, $obj0->getHideDelay());
57
        $this->assertEquals(8, $obj0->getPadding());
58
        $this->assertEquals("<span style=\"color:{point.color}\">\\u25CF</span> {series.name}: <b>{point.y}</b><br/>", $obj0->getPointFormat());
59
        $this->assertEquals(null, $obj0->getPointFormatter());
60
        $this->assertEquals(false, $obj0->getSplit());
61
        $this->assertEquals(null, $obj0->getValueDecimals());
62
        $this->assertEquals(null, $obj0->getValuePrefix());
63
        $this->assertEquals(null, $obj0->getValueSuffix());
64
        $this->assertEquals(null, $obj0->getXDateFormat());
65
    }
66
67
    /**
68
     * Tests the jsonSerialize() method.
69
     *
70
     * @return void
71
     */
72
    public function testJsonSerialize() {
73
74
        $obj = new \WBW\Bundle\HighchartsBundle\API\Chart\PlotOptions\Series\HighchartsTooltip(true);
75
76
        $this->assertEquals([], $obj->jsonSerialize());
77
    }
78
79
    /**
80
     * Tests the toArray() method.
81
     *
82
     * @return void
83
     */
84
    public function testToArray() {
85
86
        $obj = new \WBW\Bundle\HighchartsBundle\API\Chart\PlotOptions\Series\HighchartsTooltip(true);
87
88
        $obj->setDateTimeLabelFormats(["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"]);
89
90
        $res1 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"]];
91
        $this->assertEquals($res1, $obj->toArray());
92
93
        $obj->setFollowPointer(0);
94
95
        $res2 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0];
96
        $this->assertEquals($res2, $obj->toArray());
97
98
        $obj->setFollowTouchMove(1);
99
100
        $res3 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1];
101
        $this->assertEquals($res3, $obj->toArray());
102
103
        $obj->setFooterFormat("1ac32e030fc5ef01e703d5419170690e");
104
105
        $res4 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e"];
106
        $this->assertEquals($res4, $obj->toArray());
107
108
        $obj->setHeaderFormat("937148825f6c7c8ed3376d1834b17ac6");
109
110
        $res5 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6"];
111
        $this->assertEquals($res5, $obj->toArray());
112
113
        $obj->setHideDelay(71);
114
115
        $res6 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 71];
116
        $this->assertEquals($res6, $obj->toArray());
117
118
        $obj->setPadding(70);
119
120
        $res7 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 71, "padding" => 70];
121
        $this->assertEquals($res7, $obj->toArray());
122
123
        $obj->setPointFormat("332dd3de68dc71de0745837cbc13e217");
124
125
        $res8 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 71, "padding" => 70, "pointFormat" => "332dd3de68dc71de0745837cbc13e217"];
126
        $this->assertEquals($res8, $obj->toArray());
127
128
        $obj->setPointFormatter("d0b51d7b9a5189f718d161b366d33044");
129
130
        $res9 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 71, "padding" => 70, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044"];
131
        $this->assertEquals($res9, $obj->toArray());
132
133
        $obj->setSplit(0);
134
135
        $res10 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 71, "padding" => 70, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044", "split" => 0];
136
        $this->assertEquals($res10, $obj->toArray());
137
138
        $obj->setValueDecimals(99);
139
140
        $res11 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 71, "padding" => 70, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044", "split" => 0, "valueDecimals" => 99];
141
        $this->assertEquals($res11, $obj->toArray());
142
143
        $obj->setValuePrefix("5fde1c8b25eb2ea19ff8377e62564818");
144
145
        $res12 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 71, "padding" => 70, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044", "split" => 0, "valueDecimals" => 99, "valuePrefix" => "5fde1c8b25eb2ea19ff8377e62564818"];
146
        $this->assertEquals($res12, $obj->toArray());
147
148
        $obj->setValueSuffix("bf995908ddff004471c953d8062bd1db");
149
150
        $res13 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 71, "padding" => 70, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044", "split" => 0, "valueDecimals" => 99, "valuePrefix" => "5fde1c8b25eb2ea19ff8377e62564818", "valueSuffix" => "bf995908ddff004471c953d8062bd1db"];
151
        $this->assertEquals($res13, $obj->toArray());
152
153
        $obj->setXDateFormat("e24debfa0bc8408e1dda05cbd537a072");
154
155
        $res14 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 71, "padding" => 70, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044", "split" => 0, "valueDecimals" => 99, "valuePrefix" => "5fde1c8b25eb2ea19ff8377e62564818", "valueSuffix" => "bf995908ddff004471c953d8062bd1db", "xDateFormat" => "e24debfa0bc8408e1dda05cbd537a072"];
156
        $this->assertEquals($res14, $obj->toArray());
157
    }
158
159
}
160