@@ -15,6 +15,9 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase
15
15
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\StoreManagerInterface */
16
16
private $ storeManagerMock ;
17
17
18
+ /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Locale\ResolverInterface */
19
+ private $ localeResolverMock ;
20
+
18
21
/** @var \Magento\Webapi\Controller\PathProcessor */
19
22
private $ model ;
20
23
@@ -26,16 +29,22 @@ class PathProcessorTest extends \PHPUnit\Framework\TestCase
26
29
27
30
protected function setUp ()
28
31
{
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 );
39
48
}
40
49
41
50
/**
0 commit comments