Skip to content

Commit 9efef99

Browse files
committed
Admin > Advanced Report > Changing link
1 parent 3666e03 commit 9efef99

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

app/code/Magento/Analytics/Model/ReportUrlProvider.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ class ReportUrlProvider
4747
*/
4848
private $urlReportConfigPath = 'analytics/url/report';
4949

50+
/**
51+
* Path to Advanced Reporting documentation URL.
52+
*
53+
* @var string
54+
*/
55+
private $urlReportDocConfigPath = 'analytics/url/documentation';
56+
5057
/**
5158
* @param AnalyticsToken $analyticsToken
5259
* @param OTPRequest $otpRequest
@@ -80,13 +87,15 @@ public function getUrl()
8087
));
8188
}
8289

83-
$url = $this->config->getValue($this->urlReportConfigPath);
8490
if ($this->analyticsToken->isTokenExist()) {
91+
$url = $this->config->getValue($this->urlReportConfigPath);
8592
$otp = $this->otpRequest->call();
8693
if ($otp) {
8794
$query = http_build_query(['otp' => $otp], '', '&');
8895
$url .= '?' . $query;
8996
}
97+
} else {
98+
$url = $this->config->getValue($this->urlReportDocConfigPath);
9099
}
91100

92101
return $url;

app/code/Magento/Analytics/Test/Unit/Model/ReportUrlProviderTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ class ReportUrlProviderTest extends \PHPUnit\Framework\TestCase
5454
*/
5555
private $urlReportConfigPath = 'path/url/report';
5656

57+
/**
58+
* @var string
59+
*/
60+
private $urlReportDocConfigPath = 'analytics/url/documentation';
61+
5762
/**
5863
* @return void
5964
*/
@@ -87,12 +92,24 @@ protected function setUp()
8792
'urlReportConfigPath' => $this->urlReportConfigPath,
8893
]
8994
);
95+
96+
$this->reportUrlProvider = $this->objectManagerHelper->getObject(
97+
ReportUrlProvider::class,
98+
[
99+
'config' => $this->configMock,
100+
'analyticsToken' => $this->analyticsTokenMock,
101+
'otpRequest' => $this->otpRequestMock,
102+
'flagManager' => $this->flagManagerMock,
103+
'urlReportDocConfigPath' => $this->urlReportDocConfigPath,
104+
]
105+
);
90106
}
91107

92108
/**
93109
* @param bool $isTokenExist
94110
* @param string|null $otp If null OTP was not received.
95111
*
112+
* @throws SubscriptionUpdateException
96113
* @dataProvider getUrlDataProvider
97114
*/
98115
public function testGetUrl($isTokenExist, $otp)
@@ -105,6 +122,11 @@ public function testGetUrl($isTokenExist, $otp)
105122
->method('getValue')
106123
->with($this->urlReportConfigPath)
107124
->willReturn($reportUrl);
125+
$this->configMock
126+
->expects($this->once())
127+
->method('getValue')
128+
->with($this->urlReportDocConfigPath)
129+
->willReturn($reportUrl);
108130
$this->analyticsTokenMock
109131
->expects($this->once())
110132
->method('isTokenExist')
@@ -135,6 +157,7 @@ public function getUrlDataProvider()
135157

136158
/**
137159
* @return void
160+
* @throws SubscriptionUpdateException
138161
*/
139162
public function testGetUrlWhenSubscriptionUpdateRunning()
140163
{

app/code/Magento/Analytics/etc/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<otp>https://advancedreporting.rjmetrics.com/otp</otp>
1616
<report>https://advancedreporting.rjmetrics.com/report</report>
1717
<notify_data_changed>https://advancedreporting.rjmetrics.com/report</notify_data_changed>
18+
<documentation>https://docs.magento.com/m2/ce/user_guide/reports/advanced-reporting.html</documentation>
1819
</url>
1920
<integration_name>Magento Analytics user</integration_name>
2021
<general>

0 commit comments

Comments
 (0)