@@ -46,7 +46,6 @@ protected function setUp()
46
46
}
47
47
48
48
/**
49
- * @magentoDbIsolation disabled
50
49
* @magentoDataFixture Magento/Sales/_files/order_list_with_invoice.php
51
50
* @dataProvider chartUrlDataProvider
52
51
* @param string $period
@@ -58,8 +57,7 @@ public function testGetChartUrl(string $period, string $expectedAxisRange): void
58
57
$ this ->graphBlock ->getRequest ()->setParams (['period ' => $ period ]);
59
58
$ ordersBlock = $ this ->layout ->createBlock (Orders::class);
60
59
$ decodedChartUrl = urldecode ($ ordersBlock ->getChartUrl ());
61
- $ chartUrlSegments = explode ('& ' , $ decodedChartUrl );
62
- $ this ->assertEquals ($ expectedAxisRange , $ this ->getUrlParamData ($ chartUrlSegments , 'chxr ' ));
60
+ $ this ->assertEquals ($ expectedAxisRange , $ this ->getUrlParamData ($ decodedChartUrl , 'chxr ' ));
63
61
}
64
62
65
63
/**
@@ -77,18 +75,20 @@ public function chartUrlDataProvider(): array
77
75
}
78
76
79
77
/**
80
- * @param array $chartUrlSegments
78
+ * @param string $chartUrl
81
79
* @param string $paramName
82
80
* @return string
83
81
*/
84
- private function getUrlParamData (array $ chartUrlSegments , string $ paramName ): string
82
+ private function getUrlParamData (string $ chartUrl , string $ paramName ): string
85
83
{
86
- $ urlParams = [] ;
84
+ $ chartUrlSegments = explode ( ' & ' , $ chartUrl ) ;
87
85
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
+ }
90
90
}
91
91
92
- return $ urlParams [ $ paramName ] ?? '' ;
92
+ return '' ;
93
93
}
94
94
}
0 commit comments