Skip to content

Commit d57a6c9

Browse files
committed
Add formatter tests and remove unneeded test attribute
1 parent 44e86c7 commit d57a6c9

File tree

1 file changed

+60
-11
lines changed

1 file changed

+60
-11
lines changed

tests/Feature/ChartsTest.php

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
class ChartsTest extends TestCase
99
{
10-
/** @test */
1110
public function testDefaultChart()
1211
{
1312
$chart = (new Chart)->setTitle('Users Test Chart');
@@ -16,7 +15,6 @@ public function testDefaultChart()
1615
$this->assertEquals('line', $chart->getType());
1716
}
1817

19-
/** @test */
2018
public function testPieChart()
2119
{
2220
$chart = (new Chart)->setType('pie')
@@ -30,7 +28,6 @@ public function testPieChart()
3028
$this->assertEquals('pie', $chart->getType());
3129
}
3230

33-
/** @test */
3431
public function testDonutChart()
3532
{
3633
$chart = (new Chart)->setType('donut')
@@ -42,7 +39,6 @@ public function testDonutChart()
4239
$this->assertEquals('donut', $chart->getType());
4340
}
4441

45-
/** @test */
4642
public function testRadialChart()
4743
{
4844
$chart = (new Chart)->setType('radial')
@@ -54,7 +50,6 @@ public function testRadialChart()
5450
$this->assertEquals('radial', $chart->getType());
5551
}
5652

57-
/** @test */
5853
public function testPolarChart()
5954
{
6055
$chart = (new Chart)->setType('polarArea')
@@ -66,7 +61,6 @@ public function testPolarChart()
6661
$this->assertEquals('polarArea', $chart->getType());
6762
}
6863

69-
/** @test */
7064
public function testLineChart()
7165
{
7266
$chart = (new Chart)->setType('line')
@@ -90,7 +84,6 @@ public function testLineChart()
9084
$this->assertEquals('line', $chart->getType());
9185
}
9286

93-
/** @test */
9487
public function testAreaChart()
9588
{
9689
$chart = (new Chart)->setType('area')
@@ -115,7 +108,6 @@ public function testAreaChart()
115108
$this->assertEquals('area', $chart->getType());
116109
}
117110

118-
/** @test */
119111
public function testBarChart()
120112
{
121113
$chart = (new Chart)->setType('bar')
@@ -153,7 +145,6 @@ public function testBarChart()
153145
$this->assertEquals('bar', $chart->getType());
154146
}
155147

156-
/** @test */
157148
public function testHorizontalBarChart()
158149
{
159150
$chart = (new Chart)->setType('bar')
@@ -181,7 +172,6 @@ public function testHorizontalBarChart()
181172
$this->assertTrue($chart->getHorizontal());
182173
}
183174

184-
/** @test */
185175
public function testHeatmapChart()
186176
{
187177
$chart = (new Chart)->setType('heatmap')
@@ -205,7 +195,6 @@ public function testHeatmapChart()
205195
$this->assertEquals('heatmap', $chart->getType());
206196
}
207197

208-
/** @test */
209198
public function testRadarChart()
210199
{
211200
$chart = (new Chart)->setType('radar')
@@ -228,4 +217,64 @@ public function testRadarChart()
228217
$this->assertEquals($chart, $chart->script()['chart']);
229218
$this->assertEquals('radar', $chart->getType());
230219
}
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(
277+
json_decode($response->content(), true))
278+
);
279+
}
231280
}

0 commit comments

Comments
 (0)