Skip to content

Commit d28f80f

Browse files
committed
MC-23228: A wrong behaviour of a chart order
1 parent 7ebaa5c commit d28f80f

File tree

1 file changed

+9
-9
lines changed
  • dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Tab

1 file changed

+9
-9
lines changed

dev/tests/integration/testsuite/Magento/Backend/Block/Dashboard/Tab/OrdersTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ protected function setUp()
4646
}
4747

4848
/**
49-
* @magentoDbIsolation disabled
5049
* @magentoDataFixture Magento/Sales/_files/order_list_with_invoice.php
5150
* @dataProvider chartUrlDataProvider
5251
* @param string $period
@@ -58,8 +57,7 @@ public function testGetChartUrl(string $period, string $expectedAxisRange): void
5857
$this->graphBlock->getRequest()->setParams(['period' => $period]);
5958
$ordersBlock = $this->layout->createBlock(Orders::class);
6059
$decodedChartUrl = urldecode($ordersBlock->getChartUrl());
61-
$chartUrlSegments = explode('&', $decodedChartUrl);
62-
$this->assertEquals($expectedAxisRange, $this->getUrlParamData($chartUrlSegments, 'chxr'));
60+
$this->assertEquals($expectedAxisRange, $this->getUrlParamData($decodedChartUrl, 'chxr'));
6361
}
6462

6563
/**
@@ -77,18 +75,20 @@ public function chartUrlDataProvider(): array
7775
}
7876

7977
/**
80-
* @param array $chartUrlSegments
78+
* @param string $chartUrl
8179
* @param string $paramName
8280
* @return string
8381
*/
84-
private function getUrlParamData(array $chartUrlSegments, string $paramName): string
82+
private function getUrlParamData(string $chartUrl, string $paramName): string
8583
{
86-
$urlParams = [];
84+
$chartUrlSegments = explode('&', $chartUrl);
8785
foreach ($chartUrlSegments as $chartUrlSegment) {
88-
list($paramKey, $paramValue) = explode('=', $chartUrlSegment);
89-
$urlParams[$paramKey] = $paramValue;
86+
[$paramKey, $paramValue] = explode('=', $chartUrlSegment);
87+
if ($paramKey === $paramName) {
88+
return $paramValue;
89+
}
9090
}
9191

92-
return $urlParams[$paramName] ?? '';
92+
return '';
9393
}
9494
}

0 commit comments

Comments
 (0)