|
13 | 13 | use Magento\GraphQl\Model\Query\ContextExtensionInterface;
|
14 | 14 | use Magento\Store\Api\Data\StoreInterface;
|
15 | 15 | use Magento\Store\Model\StoreManagerInterface;
|
| 16 | +use Magento\Store\Model\Website; |
16 | 17 | use Magento\Wishlist\Model\ResourceModel\Item;
|
17 | 18 | use Magento\Wishlist\Model\ResourceModel\Item\Collection as WishlistItemCollection;
|
18 | 19 | use Magento\Wishlist\Model\ResourceModel\Item\CollectionFactory as WishlistItemCollectionFactory;
|
@@ -49,18 +50,18 @@ protected function setUp(): void
|
49 | 50 | */
|
50 | 51 | public function testResolve(): void
|
51 | 52 | {
|
52 |
| - $storeId = $itemId = 1; |
| 53 | + $webId = $storeId = $itemId = 1; |
53 | 54 |
|
54 | 55 | $field = $this->createMock(Field::class);
|
55 | 56 | $context = $this->getMockBuilder(ContextInterface::class)
|
56 | 57 | ->disableOriginalConstructor()
|
57 | 58 | ->getMock();
|
58 | 59 | $store = $this->createMock(StoreInterface::class);
|
59 |
| - $store->expects($this->once())->method('getId')->willReturn($storeId); |
| 60 | + $store->expects($this->once())->method('getWebsiteId')->willReturn($webId); |
| 61 | + $store->expects($this->any())->method('getId')->willReturn($storeId); |
60 | 62 |
|
61 | 63 | $extensionAttributes = $this->getMockBuilder(ContextExtensionInterface::class)
|
62 | 64 | ->disableOriginalConstructor()
|
63 |
| - ->addMethods(['getStore']) |
64 | 65 | ->getMock();
|
65 | 66 | $extensionAttributes->expects($this->exactly(2))
|
66 | 67 | ->method('getStore')
|
@@ -100,6 +101,10 @@ public function testResolve(): void
|
100 | 101 | ->method('create')
|
101 | 102 | ->willReturn($wishlistCollection);
|
102 | 103 |
|
| 104 | + $website = $this->createMock(Website::class); |
| 105 | + $website->expects($this->any())->method('getStores')->willReturn([$store]); |
| 106 | + $this->storeManager->expects($this->once())->method('getWebsite')->with($webId)->willReturn($website); |
| 107 | + |
103 | 108 | $resolver = new WishlistItems($this->wishlistItemCollectionFactory, $this->storeManager);
|
104 | 109 | $resolver->resolve($field, $context, $info, ['model' => $wishlist]);
|
105 | 110 | }
|
|
0 commit comments