File tree Expand file tree Collapse file tree 1 file changed +81
-0
lines changed
dev/tests/integration/testsuite/Magento/Backend/Model/Dashboard Expand file tree Collapse file tree 1 file changed +81
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \Backend \Model ;
9
+
10
+ use Magento \Backend \Model \Dashboard \Chart ;
11
+ use Magento \TestFramework \Helper \Bootstrap ;
12
+ use PHPUnit \Framework \TestCase ;
13
+
14
+ /**
15
+ * Verify chart data by different period.
16
+ *
17
+ * @magentoAppArea adminhtml
18
+ */
19
+ class ChartTest extends TestCase
20
+ {
21
+ /**
22
+ * @var Chart
23
+ */
24
+ private $ model ;
25
+
26
+ /**
27
+ * @inheritdoc
28
+ */
29
+ protected function setUp ()
30
+ {
31
+ $ this ->model = Bootstrap::getObjectManager ()->create (Chart::class);
32
+ }
33
+
34
+ /**
35
+ * Verify getByPeriod with all types of period
36
+ *
37
+ * @magentoDataFixture Magento/Sales/_files/order_list_with_invoice.php
38
+ * @dataProvider getChartDataProvider
39
+ * @return void
40
+ */
41
+ public function testGetByPeriodWithParam (int $ expectedDataQty , string $ period , string $ chartParam ): void
42
+ {
43
+ $ this ->assertCount ($ expectedDataQty , $ this ->model ->getByPeriod ($ period , $ chartParam ));
44
+ }
45
+
46
+ /**
47
+ * Expected chart data
48
+ *
49
+ * @return array
50
+ */
51
+ public function getChartDataProvider (): array
52
+ {
53
+ return [
54
+ [
55
+ 24 ,
56
+ '24h ' ,
57
+ 'quantity '
58
+ ],
59
+ [
60
+ 8 ,
61
+ '7d ' ,
62
+ 'quantity '
63
+ ],
64
+ [
65
+ 6 ,
66
+ '1m ' ,
67
+ 'quantity '
68
+ ],
69
+ [
70
+ 16 ,
71
+ '1y ' ,
72
+ 'quantity '
73
+ ],
74
+ [
75
+ 28 ,
76
+ '2y ' ,
77
+ 'quantity '
78
+ ]
79
+ ];
80
+ }
81
+ }
You can’t perform that action at this time.
0 commit comments