Skip to content

Commit 316133a

Browse files
committed
#20968: Unit test fix.
1 parent 8af727d commit 316133a

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

app/code/Magento/Store/Test/Unit/Model/StoreTest.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function testGetWebsite()
160160
/** @var \Magento\Store\Model\Store $model */
161161
$model = $this->objectManagerHelper->getObject(
162162
\Magento\Store\Model\Store::class,
163-
['websiteRepository' => $websiteRepository,]
163+
['websiteRepository' => $websiteRepository]
164164
);
165165
$model->setWebsiteId($websiteId);
166166

@@ -181,7 +181,7 @@ public function testGetWebsiteIfWebsiteIsNotExist()
181181
/** @var \Magento\Store\Model\Store $model */
182182
$model = $this->objectManagerHelper->getObject(
183183
\Magento\Store\Model\Store::class,
184-
['websiteRepository' => $websiteRepository,]
184+
['websiteRepository' => $websiteRepository]
185185
);
186186
$model->setWebsiteId(null);
187187

@@ -207,7 +207,7 @@ public function testGetGroup()
207207
/** @var \Magento\Store\Model\Store $model */
208208
$model = $this->objectManagerHelper->getObject(
209209
\Magento\Store\Model\Store::class,
210-
['groupRepository' => $groupRepository,]
210+
['groupRepository' => $groupRepository]
211211
);
212212
$model->setGroupId($groupId);
213213

@@ -228,7 +228,7 @@ public function testGetGroupIfGroupIsNotExist()
228228
/** @var \Magento\Store\Model\Store $model */
229229
$model = $this->objectManagerHelper->getObject(
230230
\Magento\Store\Model\Store::class,
231-
['groupRepository' => $groupRepository,]
231+
['groupRepository' => $groupRepository]
232232
);
233233
$model->setGroupId(null);
234234

@@ -377,30 +377,31 @@ public function testGetBaseUrlEntryPoint()
377377
$configMock = $this->getMockForAbstractClass(\Magento\Framework\App\Config\ReinitableConfigInterface::class);
378378
$configMock->expects($this->atLeastOnce())
379379
->method('getValue')
380-
->will($this->returnCallback(
381-
function ($path, $scope, $scopeCode) use ($expectedPath) {
382-
return $expectedPath == $path ? 'http://domain.com/' . $path . '/' : null;
383-
}
384-
));
380+
->willReturnCallback(function ($path, $scope, $scopeCode) use ($expectedPath) {
381+
return $expectedPath == $path ? 'http://domain.com/' . $path . '/' : null;
382+
});
383+
$this->requestMock->expects($this->once())
384+
->method('getServer')
385+
->with('SCRIPT_FILENAME')
386+
->willReturn('test_script.php');
387+
385388
/** @var \Magento\Store\Model\Store $model */
386389
$model = $this->objectManagerHelper->getObject(
387390
\Magento\Store\Model\Store::class,
388391
[
389392
'config' => $configMock,
390393
'isCustomEntryPoint' => false,
394+
'request' => $this->requestMock
391395
]
392396
);
393397
$model->setCode('scopeCode');
394398

395399
$this->setUrlModifier($model);
396400

397-
$server = $_SERVER;
398-
$_SERVER['SCRIPT_FILENAME'] = 'test_script.php';
399401
$this->assertEquals(
400402
$expectedBaseUrl,
401403
$model->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, false)
402404
);
403-
$_SERVER = $server;
404405
}
405406

406407
/**
@@ -592,7 +593,7 @@ public function testGetAllowedCurrencies()
592593
/** @var \Magento\Store\Model\Store $model */
593594
$model = $this->objectManagerHelper->getObject(
594595
\Magento\Store\Model\Store::class,
595-
['config' => $configMock, 'currencyInstalled' => $currencyPath,]
596+
['config' => $configMock, 'currencyInstalled' => $currencyPath]
596597
);
597598

598599
$this->assertEquals($expectedResult, $model->getAllowedCurrencies());
@@ -666,8 +667,7 @@ public function isCurrentlySecureDataProvider()
666667
'unsecure request, no secure base url registered' => [false, 443, false, true, null],
667668
'unsecure request, not using registered port' => [false, 80],
668669
'unsecure request, using registered port, not using secure in frontend' => [false, 443, false, false],
669-
'unsecure request, no secure base url registered, not using secure in frontend' =>
670-
[false, 443, false, false, null],
670+
'unsecure request, no secure base url registered, not using secure in frontend' => [false, 443, false, false, null],
671671
'unsecure request, not using registered port, not using secure in frontend' => [false, 80, false, false],
672672
];
673673
}

0 commit comments

Comments
 (0)