/** * @expectedException \DomainException * @expectedExceptionMessage Default website is not defined */ public function testGetDefaultIsZero() { $collectionMock = $this->getMockBuilder('Magento\\Store\\Model\\ResourceModel\\Website\\Collection')->disableOriginalConstructor()->setMethods([])->getMock(); $this->websiteCollectionFactoryMock->expects($this->any())->method('create')->willReturn($collectionMock); $collectionMock->expects($this->any())->method('addFieldToFilter'); $collectionMock->expects($this->any())->method('getItems')->willReturn([]); $this->model->getDefault(); }
/** * @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; }