Skip to content

Commit 29b4b39

Browse files
author
Julian Wundrak
committed
[#19908] Fix WebapiAyncTest
1 parent ef724a6 commit 29b4b39

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

app/code/Magento/Webapi/Test/Unit/Controller/PathProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected function setUp()
5050
*
5151
* @param string $storeCodeInPath
5252
* @param string $storeCodeSet
53-
* @param int $setCurrentStoreCallCtr
53+
* @param int $setCurrentStoreCallCtr
5454
*/
5555
public function testAllStoreCode($storeCodeInPath, $storeCodeSet, $setCurrentStoreCallCtr = 1)
5656
{

app/code/Magento/WebapiAsync/Test/Unit/Controller/PathProcessorTest.php

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase
1515
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\StoreManagerInterface */
1616
private $storeManagerMock;
1717

18+
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Locale\ResolverInterface */
19+
private $localeResolverMock;
20+
1821
/** @var \Magento\Webapi\Controller\PathProcessor */
1922
private $model;
2023

@@ -26,16 +29,22 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase
2629

2730
protected function setUp()
2831
{
29-
$this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)
30-
->disableOriginalConstructor()
31-
->getMock();
32-
$this->storeManagerMock->expects($this->once())
33-
->method('getStores')
34-
->willReturn([
35-
$this->arbitraryStoreCode => 'store object',
36-
'default' => 'default store object',
37-
]);
38-
$this->model = new \Magento\Webapi\Controller\PathProcessor($this->storeManagerMock);
32+
$store = $this->createMock(\Magento\Store\Api\Data\StoreInterface::class);
33+
$store->method('getId')->willReturn(2);
34+
35+
$this->storeManagerMock = $this->createConfiguredMock(
36+
\Magento\Store\Model\StoreManagerInterface::class,
37+
[
38+
'getStores' => [$this->arbitraryStoreCode => 'store object', 'default' => 'default store object'],
39+
'getStore' => $store,
40+
]
41+
);
42+
$this->storeManagerMock->expects($this->once())->method('getStores');
43+
44+
$this->localeResolverMock = $this->createMock(\Magento\Framework\Locale\ResolverInterface::class);
45+
$this->localeResolverMock->method('emulate')->with(2);
46+
47+
$this->model = new \Magento\Webapi\Controller\PathProcessor($this->storeManagerMock, $this->localeResolverMock);
3948
}
4049

4150
/**

0 commit comments

Comments
 (0)