7
7
8
8
class ChartsTest extends TestCase
9
9
{
10
- /** @test */
11
10
public function testDefaultChart ()
12
11
{
13
12
$ chart = (new Chart )->setTitle ('Users Test Chart ' );
@@ -16,7 +15,6 @@ public function testDefaultChart()
16
15
$ this ->assertEquals ('line ' , $ chart ->getType ());
17
16
}
18
17
19
- /** @test */
20
18
public function testPieChart ()
21
19
{
22
20
$ chart = (new Chart )->setType ('pie ' )
@@ -30,7 +28,6 @@ public function testPieChart()
30
28
$ this ->assertEquals ('pie ' , $ chart ->getType ());
31
29
}
32
30
33
- /** @test */
34
31
public function testDonutChart ()
35
32
{
36
33
$ chart = (new Chart )->setType ('donut ' )
@@ -42,7 +39,6 @@ public function testDonutChart()
42
39
$ this ->assertEquals ('donut ' , $ chart ->getType ());
43
40
}
44
41
45
- /** @test */
46
42
public function testRadialChart ()
47
43
{
48
44
$ chart = (new Chart )->setType ('radial ' )
@@ -54,7 +50,6 @@ public function testRadialChart()
54
50
$ this ->assertEquals ('radial ' , $ chart ->getType ());
55
51
}
56
52
57
- /** @test */
58
53
public function testPolarChart ()
59
54
{
60
55
$ chart = (new Chart )->setType ('polarArea ' )
@@ -66,7 +61,6 @@ public function testPolarChart()
66
61
$ this ->assertEquals ('polarArea ' , $ chart ->getType ());
67
62
}
68
63
69
- /** @test */
70
64
public function testLineChart ()
71
65
{
72
66
$ chart = (new Chart )->setType ('line ' )
@@ -90,7 +84,6 @@ public function testLineChart()
90
84
$ this ->assertEquals ('line ' , $ chart ->getType ());
91
85
}
92
86
93
- /** @test */
94
87
public function testAreaChart ()
95
88
{
96
89
$ chart = (new Chart )->setType ('area ' )
@@ -115,7 +108,6 @@ public function testAreaChart()
115
108
$ this ->assertEquals ('area ' , $ chart ->getType ());
116
109
}
117
110
118
- /** @test */
119
111
public function testBarChart ()
120
112
{
121
113
$ chart = (new Chart )->setType ('bar ' )
@@ -153,7 +145,6 @@ public function testBarChart()
153
145
$ this ->assertEquals ('bar ' , $ chart ->getType ());
154
146
}
155
147
156
- /** @test */
157
148
public function testHorizontalBarChart ()
158
149
{
159
150
$ chart = (new Chart )->setType ('bar ' )
@@ -181,7 +172,6 @@ public function testHorizontalBarChart()
181
172
$ this ->assertTrue ($ chart ->getHorizontal ());
182
173
}
183
174
184
- /** @test */
185
175
public function testHeatmapChart ()
186
176
{
187
177
$ chart = (new Chart )->setType ('heatmap ' )
@@ -205,7 +195,6 @@ public function testHeatmapChart()
205
195
$ this ->assertEquals ('heatmap ' , $ chart ->getType ());
206
196
}
207
197
208
- /** @test */
209
198
public function testRadarChart ()
210
199
{
211
200
$ chart = (new Chart )->setType ('radar ' )
@@ -228,4 +217,62 @@ public function testRadarChart()
228
217
$ this ->assertEquals ($ chart , $ chart ->script ()['chart ' ]);
229
218
$ this ->assertEquals ('radar ' , $ chart ->getType ());
230
219
}
220
+
221
+ public function testToVue ()
222
+ {
223
+ $ chart = (new Chart )->setType ('line ' )
224
+ ->setTitle ('Total Users Monthly ' )
225
+ ->setSubtitle ('From January to March ' )
226
+ ->setSeries ([
227
+ 'Jan ' , 'Feb ' , 'Mar '
228
+ ])
229
+ ->setDataset ('Users ' , 'line ' , [
230
+ [
231
+ 'name ' => 'Active Users ' ,
232
+ 'data ' => [250 , 700 , 1200 ]
233
+ ]
234
+ ])
235
+ ->setHeight (250 )
236
+ ->setGridShow (true )
237
+ ->setStrokeShow (true );
238
+
239
+ $ this ->assertEquals ([
240
+ 'id ' ,
241
+ 'height ' ,
242
+ 'width ' ,
243
+ 'type ' ,
244
+ 'options ' ,
245
+ 'series ' ,
246
+ ], array_keys ($ chart ->toVue ()));
247
+ }
248
+
249
+ public function testToJson ()
250
+ {
251
+ $ chart = (new Chart )->setType ('line ' )
252
+ ->setTitle ('Total Users Monthly ' )
253
+ ->setSubtitle ('From January to March ' )
254
+ ->setSeries ([
255
+ 'Jan ' , 'Feb ' , 'Mar '
256
+ ])
257
+ ->setDataset ('Users ' , 'line ' , [
258
+ [
259
+ 'name ' => 'Active Users ' ,
260
+ 'data ' => [250 , 700 , 1200 ]
261
+ ]
262
+ ])
263
+ ->setHeight (250 )
264
+ ->setGridShow (true )
265
+ ->setStrokeShow (true );
266
+
267
+ $ response = $ chart ->toJson ();
268
+
269
+ $ this ->assertEquals ([
270
+ 'id ' ,
271
+ 'height ' ,
272
+ 'width ' ,
273
+ 'type ' ,
274
+ 'options ' ,
275
+ 'series ' ,
276
+ ], array_keys (json_decode ($ response ->content (), true )));
277
+ }
231
278
}
0 commit comments