Skip to content

Commit 85701ef

Browse files
committed
renamed test functions
1 parent 4e3488d commit 85701ef

File tree

2 files changed

+26
-33
lines changed

2 files changed

+26
-33
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,11 @@ use Akaunting\Apexcharts\Chart;
4242

4343
...
4444

45-
$chart = new Chart();
46-
47-
$chart->setType('donut')
45+
$chart = (new Chart)->setType('donut')
4846
->setWidth('100%')
4947
->setHeight(300)
50-
->setLabels(['Sales', 'Deposit']);
51-
52-
$chart->setDataset('Name', 'donut', [1907, 1923]);
48+
->setLabels(['Sales', 'Deposit'])
49+
->setDataset('Income by Category', 'donut', [1907, 1923]);
5350
```
5451

5552
Then, include the JavaScript (on every page using charts).

tests/Feature/ChartsTest.php

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,82 +4,78 @@
44

55
use Akaunting\Apexcharts\Chart;
66
use Akaunting\Apexcharts\Tests\TestCase;
7-
use Illuminate\Foundation\Testing\RefreshDatabase;
87

98
class ChartsTest extends TestCase
109
{
11-
use RefreshDatabase;
12-
1310
/** @test */
14-
public function it_tests_apexcharts_can_render_pie_charts_by_default()
11+
public function testDefaultChart()
1512
{
1613
$chart = (new Chart)->setTitle('Users Test Chart');
17-
$this->assertEquals('line', $chart->getType());
1814

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());
2117
}
2218

2319
/** @test */
24-
public function it_tests_apexcharts_can_render_pie_chart()
20+
public function testPieChart()
2521
{
2622
$chart = (new Chart)->setType('pie')
2723
->setTitle('Posts')
2824
->setSubtitle('From January To March')
2925
->setLabels(['Product One', 'Product Two', 'Product Three'])
3026
->setSeries(['Jan', 'Feb', 'Mar'])
31-
->setDataset('posts', 'pie', [150, 120]);
27+
->setDataset('Posts', 'pie', [150, 120]);
3228

3329
$this->assertEquals($chart, $chart->script()['chart']);
3430
$this->assertEquals('pie', $chart->getType());
3531
}
3632

3733
/** @test */
38-
public function it_tests_apexcharts_can_render_donut_chart()
34+
public function testDonutChart()
3935
{
4036
$chart = (new Chart)->setType('donut')
4137
->setTitle('Posts')
4238
->setSeries(['Jan', 'Feb', 'Mar'])
43-
->setDataset('posts', 'donut', [150, 120]);
39+
->setDataset('Posts', 'donut', [150, 120]);
4440

4541
$this->assertEquals($chart, $chart->script()['chart']);
4642
$this->assertEquals('donut', $chart->getType());
4743
}
4844

4945
/** @test */
50-
public function it_tests_larapex_can_render_radial_bar_charts()
46+
public function testRadialChart()
5147
{
5248
$chart = (new Chart)->setType('radial')
5349
->setTitle('Products with more profit')
5450
->setSeries(['Jan', 'Feb', 'Mar'])
55-
->setDataset('products', 'radial', [60, 40, 79]);
51+
->setDataset('Products', 'radial', [60, 40, 79]);
5652

5753
$this->assertEquals($chart, $chart->script()['chart']);
5854
$this->assertEquals('radial', $chart->getType());
5955
}
6056

6157
/** @test */
62-
public function it_tests_apexcharts_can_render_polar_chart()
58+
public function testPolarChart()
6359
{
6460
$chart = (new Chart)->setType('polarArea')
6561
->setTitle('Products with more profit')
6662
->setSeries(['Jan', 'Feb', 'Mar'])
67-
->setDataset('polarArea', 'radial', [60, 40, 79]);
63+
->setDataset('Products', 'polarArea', [60, 40, 79]);
6864

6965
$this->assertEquals($chart, $chart->script()['chart']);
7066
$this->assertEquals('polarArea', $chart->getType());
7167
}
7268

7369
/** @test */
74-
public function larapex_can_render_line_charts()
70+
public function testLineChart()
7571
{
7672
$chart = (new Chart)->setType('line')
7773
->setTitle('Total Users Monthly')
7874
->setSubtitle('From January to March')
7975
->setSeries([
8076
'Jan', 'Feb', 'Mar'
8177
])
82-
->setDataset('line', 'users', [
78+
->setDataset('Users', 'line', [
8379
[
8480
'name' => 'Active Users',
8581
'data' => [250, 700, 1200]
@@ -95,15 +91,15 @@ public function larapex_can_render_line_charts()
9591
}
9692

9793
/** @test */
98-
public function it_tests_apexcharts_can_create_an_area_chart()
94+
public function testAreaChart()
9995
{
10096
$chart = (new Chart)->setType('area')
10197
->setTitle('Total Users Monthly')
10298
->setSubtitle('From January to March')
10399
->setSeries([
104100
'Jan', 'Feb', 'Mar'
105101
])
106-
->setDataset('area', 'users', [
102+
->setDataset('Users', 'area', [
107103
[
108104
'name' => 'Active Users',
109105
'data' => [250, 700, 1200]
@@ -120,12 +116,12 @@ public function it_tests_apexcharts_can_create_an_area_chart()
120116
}
121117

122118
/** @test */
123-
public function it_tests_apexcharts_can_render_bar_charts()
119+
public function testBarChart()
124120
{
125121
$chart = (new Chart)->setType('bar')
126122
->setTitle('Net Profit')
127123
->setSeries(['Jan', 'Feb', 'Mar'])
128-
->setDataset('bar', 'profit', [
124+
->setDataset('Net Profit', 'bar', [
129125
[
130126
'name' => 'Company A',
131127
'data' => [500, 1000, 1900]
@@ -158,13 +154,13 @@ public function it_tests_apexcharts_can_render_bar_charts()
158154
}
159155

160156
/** @test */
161-
public function it_tests_apexcharts_can_render_horizontal_bar_chart()
157+
public function testHorizontalBarChart()
162158
{
163159
$chart = (new Chart)->setType('bar')
164160
->setTitle('Net Profit')
165161
->setHorizontal(true)
166162
->setSeries(['Jan', 'Feb', 'Mar'])
167-
->setDataset('bar', 'profit', [
163+
->setDataset('Net Profit', 'bar', [
168164
[
169165
'name' => 'Company A',
170166
'data' => [500, 1000, 1900]
@@ -186,14 +182,14 @@ public function it_tests_apexcharts_can_render_horizontal_bar_chart()
186182
}
187183

188184
/** @test */
189-
public function it_tests_apexcharts_can_render_heatmap_chart()
185+
public function testHeatmapChart()
190186
{
191187
$chart = (new Chart)->setType('heatmap')
192188
->setTitle('Total Users')
193189
->setSeries([
194190
'Jan', 'Feb', 'Mar'
195191
])
196-
->setDataset('heatmap', 'users', [
192+
->setDataset('Users', 'heatmap', [
197193
[
198194
'name' => 'Users of Basic Plan',
199195
'data' => [250, 700, 1200]
@@ -210,14 +206,14 @@ public function it_tests_apexcharts_can_render_heatmap_chart()
210206
}
211207

212208
/** @test */
213-
public function it_tests_apexcharts_can_render_radar_chart()
209+
public function testRadarChart()
214210
{
215211
$chart = (new Chart)->setType('radar')
216212
->setTitle('Total Users')
217213
->setSeries([
218214
'Jan', 'Feb', 'Mar'
219215
])
220-
->setDataset('radar', 'users', [
216+
->setDataset('Users', 'radar', [
221217
[
222218
'name' => 'Users of Basic Plan',
223219
'data' => [250, 700, 1200]

0 commit comments

Comments
 (0)