Skip to content

Commit

Permalink
[#19908] Fix WebapiAyncTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jwundrak committed Dec 27, 2018
1 parent ef724a6 commit 29b4b39
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function setUp()
*
* @param string $storeCodeInPath
* @param string $storeCodeSet
* @param int $setCurrentStoreCallCtr
* @param int $setCurrentStoreCallCtr
*/
public function testAllStoreCode($storeCodeInPath, $storeCodeSet, $setCurrentStoreCallCtr = 1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\StoreManagerInterface */
private $storeManagerMock;

/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Locale\ResolverInterface */
private $localeResolverMock;

/** @var \Magento\Webapi\Controller\PathProcessor */
private $model;

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

protected function setUp()
{
$this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)
->disableOriginalConstructor()
->getMock();
$this->storeManagerMock->expects($this->once())
->method('getStores')
->willReturn([
$this->arbitraryStoreCode => 'store object',
'default' => 'default store object',
]);
$this->model = new \Magento\Webapi\Controller\PathProcessor($this->storeManagerMock);
$store = $this->createMock(\Magento\Store\Api\Data\StoreInterface::class);
$store->method('getId')->willReturn(2);

$this->storeManagerMock = $this->createConfiguredMock(
\Magento\Store\Model\StoreManagerInterface::class,
[
'getStores' => [$this->arbitraryStoreCode => 'store object', 'default' => 'default store object'],
'getStore' => $store,
]
);
$this->storeManagerMock->expects($this->once())->method('getStores');

$this->localeResolverMock = $this->createMock(\Magento\Framework\Locale\ResolverInterface::class);
$this->localeResolverMock->method('emulate')->with(2);

$this->model = new \Magento\Webapi\Controller\PathProcessor($this->storeManagerMock, $this->localeResolverMock);
}

/**
Expand Down

0 comments on commit 29b4b39

Please sign in to comment.