public function testGetId() { $storeId = 2; $websiteId = 55; $this->storeSwitcher->expects($this->once())->method('isInitialized')->willReturn(true); $store = $this->getMock('Magento\\Store\\Api\\Data\\StoreInterface'); $store->expects($this->once())->method('getWebsiteId')->willReturn($websiteId); $this->storeSwitcher->expects($this->once())->method('getStoreId')->willReturn($storeId); $this->storeRepository->expects($this->once())->method('getById')->with($storeId)->willReturn($store); $this->assertSame($websiteId, $this->geoWebsite->getId()); $this->assertSame($websiteId, $this->geoWebsite->getId()); }
/** * @param \Magento\Store\Model\WebsiteRepository $subject * @param \Magento\Store\Model\Website $website * @return \Magento\Store\Model\Website */ public function afterGetDefault(WebsiteRepository $subject, Website $website) { if (!$this->isNeededProcess()) { return $website; } if ($this->geoWebsite->getId() != $website->getId()) { $website = $subject->getById($this->geoWebsite->getId()); } return $website; }
protected function setGeoWebsiteId($id) { $this->geoWebsite->expects($this->atLeastOnce())->method('getId')->willReturn($id); return $this->geoWebsite; }