Skip to content

Commit 7fc4e5c

Browse files
committed
Integration test fix
1 parent cd5dfa6 commit 7fc4e5c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

dev/tests/integration/testsuite/Magento/Backend/Model/Dashboard/ChartTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ protected function setUp()
3939
*/
4040
public function testGetByPeriodWithParam(int $expectedDataQty, string $period, string $chartParam): void
4141
{
42-
$this->assertGreaterThan($expectedDataQty, $this->model->getByPeriod($period, $chartParam));
42+
$ordersData = $this->model->getByPeriod($period, $chartParam);
43+
$ordersCount = array_sum(array_map(function ($item) {
44+
return $item['y'];
45+
}, $ordersData));
46+
$this->assertGreaterThanOrEqual($expectedDataQty, $ordersCount);
4347
}
4448

4549
/**
@@ -51,27 +55,27 @@ public function getChartDataProvider(): array
5155
{
5256
return [
5357
[
54-
10,
58+
2,
5559
'24h',
5660
'quantity'
5761
],
5862
[
59-
4,
63+
3,
6064
'7d',
6165
'quantity'
6266
],
6367
[
64-
10,
68+
4,
6569
'1m',
6670
'quantity'
6771
],
6872
[
69-
8,
73+
5,
7074
'1y',
7175
'quantity'
7276
],
7377
[
74-
15,
78+
6,
7579
'2y',
7680
'quantity'
7781
]

dev/tests/integration/testsuite/Magento/Sales/_files/order_list_with_invoice.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
'base_grand_total' => 140.00,
5656
'grand_total' => 140.00,
5757
'subtotal' => 140.00,
58-
'created_at' => $dateTime->modify('-1 month')->format(DateTime::DATETIME_PHP_FORMAT),
58+
'created_at' => $dateTime->modify('first day of this month')->format(DateTime::DATETIME_PHP_FORMAT),
5959
],
6060
[
6161
'increment_id' => '100000005',
@@ -65,7 +65,7 @@
6565
'base_grand_total' => 150.00,
6666
'grand_total' => 150.00,
6767
'subtotal' => 150.00,
68-
'created_at' => $dateTime->modify('-1 year')->format(DateTime::DATETIME_PHP_FORMAT),
68+
'created_at' => $dateTime->modify('first day of january this year')->format(DateTime::DATETIME_PHP_FORMAT),
6969
],
7070
[
7171
'increment_id' => '100000006',
@@ -75,7 +75,7 @@
7575
'base_grand_total' => 160.00,
7676
'grand_total' => 160.00,
7777
'subtotal' => 160.00,
78-
'created_at' => $dateTime->modify('-2 year')->format(DateTime::DATETIME_PHP_FORMAT),
78+
'created_at' => $dateTime->modify('first day of january last year')->format(DateTime::DATETIME_PHP_FORMAT),
7979
],
8080
];
8181

0 commit comments

Comments
 (0)