4
4
5
5
use Akaunting \Apexcharts \Chart ;
6
6
use Akaunting \Apexcharts \Tests \TestCase ;
7
- use Illuminate \Foundation \Testing \RefreshDatabase ;
8
7
9
8
class ChartsTest extends TestCase
10
9
{
11
- use RefreshDatabase;
12
-
13
10
/** @test */
14
- public function it_tests_apexcharts_can_render_pie_charts_by_default ()
11
+ public function testDefaultChart ()
15
12
{
16
13
$ chart = (new Chart )->setTitle ('Users Test Chart ' );
17
- $ this ->assertEquals ('line ' , $ chart ->getType ());
18
14
19
- $ anotherChart = ( new Chart )-> setType ( ' area ' );
20
- $ this ->assertEquals ('area ' , $ anotherChart ->getType ());
15
+ $ this -> assertEquals ( $ chart , $ chart -> script ()[ ' chart ' ] );
16
+ $ this ->assertEquals ('line ' , $ chart ->getType ());
21
17
}
22
18
23
19
/** @test */
24
- public function it_tests_apexcharts_can_render_pie_chart ()
20
+ public function testPieChart ()
25
21
{
26
22
$ chart = (new Chart )->setType ('pie ' )
27
23
->setTitle ('Posts ' )
28
24
->setSubtitle ('From January To March ' )
29
25
->setLabels (['Product One ' , 'Product Two ' , 'Product Three ' ])
30
26
->setSeries (['Jan ' , 'Feb ' , 'Mar ' ])
31
- ->setDataset ('posts ' , 'pie ' , [150 , 120 ]);
27
+ ->setDataset ('Posts ' , 'pie ' , [150 , 120 ]);
32
28
33
29
$ this ->assertEquals ($ chart , $ chart ->script ()['chart ' ]);
34
30
$ this ->assertEquals ('pie ' , $ chart ->getType ());
35
31
}
36
32
37
33
/** @test */
38
- public function it_tests_apexcharts_can_render_donut_chart ()
34
+ public function testDonutChart ()
39
35
{
40
36
$ chart = (new Chart )->setType ('donut ' )
41
37
->setTitle ('Posts ' )
42
38
->setSeries (['Jan ' , 'Feb ' , 'Mar ' ])
43
- ->setDataset ('posts ' , 'donut ' , [150 , 120 ]);
39
+ ->setDataset ('Posts ' , 'donut ' , [150 , 120 ]);
44
40
45
41
$ this ->assertEquals ($ chart , $ chart ->script ()['chart ' ]);
46
42
$ this ->assertEquals ('donut ' , $ chart ->getType ());
47
43
}
48
44
49
45
/** @test */
50
- public function it_tests_larapex_can_render_radial_bar_charts ()
46
+ public function testRadialChart ()
51
47
{
52
48
$ chart = (new Chart )->setType ('radial ' )
53
49
->setTitle ('Products with more profit ' )
54
50
->setSeries (['Jan ' , 'Feb ' , 'Mar ' ])
55
- ->setDataset ('products ' , 'radial ' , [60 , 40 , 79 ]);
51
+ ->setDataset ('Products ' , 'radial ' , [60 , 40 , 79 ]);
56
52
57
53
$ this ->assertEquals ($ chart , $ chart ->script ()['chart ' ]);
58
54
$ this ->assertEquals ('radial ' , $ chart ->getType ());
59
55
}
60
56
61
57
/** @test */
62
- public function it_tests_apexcharts_can_render_polar_chart ()
58
+ public function testPolarChart ()
63
59
{
64
60
$ chart = (new Chart )->setType ('polarArea ' )
65
61
->setTitle ('Products with more profit ' )
66
62
->setSeries (['Jan ' , 'Feb ' , 'Mar ' ])
67
- ->setDataset ('polarArea ' , 'radial ' , [60 , 40 , 79 ]);
63
+ ->setDataset ('Products ' , 'polarArea ' , [60 , 40 , 79 ]);
68
64
69
65
$ this ->assertEquals ($ chart , $ chart ->script ()['chart ' ]);
70
66
$ this ->assertEquals ('polarArea ' , $ chart ->getType ());
71
67
}
72
68
73
69
/** @test */
74
- public function larapex_can_render_line_charts ()
70
+ public function testLineChart ()
75
71
{
76
72
$ chart = (new Chart )->setType ('line ' )
77
73
->setTitle ('Total Users Monthly ' )
78
74
->setSubtitle ('From January to March ' )
79
75
->setSeries ([
80
76
'Jan ' , 'Feb ' , 'Mar '
81
77
])
82
- ->setDataset ('line ' , 'users ' , [
78
+ ->setDataset ('Users ' , 'line ' , [
83
79
[
84
80
'name ' => 'Active Users ' ,
85
81
'data ' => [250 , 700 , 1200 ]
@@ -95,15 +91,15 @@ public function larapex_can_render_line_charts()
95
91
}
96
92
97
93
/** @test */
98
- public function it_tests_apexcharts_can_create_an_area_chart ()
94
+ public function testAreaChart ()
99
95
{
100
96
$ chart = (new Chart )->setType ('area ' )
101
97
->setTitle ('Total Users Monthly ' )
102
98
->setSubtitle ('From January to March ' )
103
99
->setSeries ([
104
100
'Jan ' , 'Feb ' , 'Mar '
105
101
])
106
- ->setDataset ('area ' , 'users ' , [
102
+ ->setDataset ('Users ' , 'area ' , [
107
103
[
108
104
'name ' => 'Active Users ' ,
109
105
'data ' => [250 , 700 , 1200 ]
@@ -120,12 +116,12 @@ public function it_tests_apexcharts_can_create_an_area_chart()
120
116
}
121
117
122
118
/** @test */
123
- public function it_tests_apexcharts_can_render_bar_charts ()
119
+ public function testBarChart ()
124
120
{
125
121
$ chart = (new Chart )->setType ('bar ' )
126
122
->setTitle ('Net Profit ' )
127
123
->setSeries (['Jan ' , 'Feb ' , 'Mar ' ])
128
- ->setDataset ('bar ' , 'profit ' , [
124
+ ->setDataset ('Net Profit ' , 'bar ' , [
129
125
[
130
126
'name ' => 'Company A ' ,
131
127
'data ' => [500 , 1000 , 1900 ]
@@ -158,13 +154,13 @@ public function it_tests_apexcharts_can_render_bar_charts()
158
154
}
159
155
160
156
/** @test */
161
- public function it_tests_apexcharts_can_render_horizontal_bar_chart ()
157
+ public function testHorizontalBarChart ()
162
158
{
163
159
$ chart = (new Chart )->setType ('bar ' )
164
160
->setTitle ('Net Profit ' )
165
161
->setHorizontal (true )
166
162
->setSeries (['Jan ' , 'Feb ' , 'Mar ' ])
167
- ->setDataset ('bar ' , 'profit ' , [
163
+ ->setDataset ('Net Profit ' , 'bar ' , [
168
164
[
169
165
'name ' => 'Company A ' ,
170
166
'data ' => [500 , 1000 , 1900 ]
@@ -186,14 +182,14 @@ public function it_tests_apexcharts_can_render_horizontal_bar_chart()
186
182
}
187
183
188
184
/** @test */
189
- public function it_tests_apexcharts_can_render_heatmap_chart ()
185
+ public function testHeatmapChart ()
190
186
{
191
187
$ chart = (new Chart )->setType ('heatmap ' )
192
188
->setTitle ('Total Users ' )
193
189
->setSeries ([
194
190
'Jan ' , 'Feb ' , 'Mar '
195
191
])
196
- ->setDataset ('heatmap ' , 'users ' , [
192
+ ->setDataset ('Users ' , 'heatmap ' , [
197
193
[
198
194
'name ' => 'Users of Basic Plan ' ,
199
195
'data ' => [250 , 700 , 1200 ]
@@ -210,14 +206,14 @@ public function it_tests_apexcharts_can_render_heatmap_chart()
210
206
}
211
207
212
208
/** @test */
213
- public function it_tests_apexcharts_can_render_radar_chart ()
209
+ public function testRadarChart ()
214
210
{
215
211
$ chart = (new Chart )->setType ('radar ' )
216
212
->setTitle ('Total Users ' )
217
213
->setSeries ([
218
214
'Jan ' , 'Feb ' , 'Mar '
219
215
])
220
- ->setDataset ('radar ' , 'users ' , [
216
+ ->setDataset ('Users ' , 'radar ' , [
221
217
[
222
218
'name ' => 'Users of Basic Plan ' ,
223
219
'data ' => [250 , 700 , 1200 ]
0 commit comments