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());
 }
 public function testAfterGetDefaultStoreNotInWebsite()
 {
     $storeId = 1;
     $websiteStoreIds = [1, 3];
     $geoStoreId = 2;
     $this->generalConfig->expects($this->once())->method('isAvailable')->willReturn(true);
     $this->storeSwitcher->expects($this->once())->method('isInitialized')->willReturn(true);
     $this->storeSwitcher->expects($this->once())->method('getStoreId')->willReturn($geoStoreId);
     $website = $this->getMockBuilder('Magento\\Store\\Model\\Website')->disableOriginalConstructor()->getMock();
     $website->expects($this->once())->method('getStoreIds')->willReturn($websiteStoreIds);
     $store = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock();
     $store->expects($this->once())->method('getId')->willReturn($storeId);
     $this->assertSame($store, $this->geoWebsite->afterGetDefaultStore($website, $store));
 }
 protected function setGeneralConfigIsInitialized($isInitialized)
 {
     $this->storeSwitcher->expects($this->once())->method('isInitialized')->willReturn($isInitialized);
     return $this->storeSwitcher;
 }
 /**
  * @param int|bool $storeId
  * @param string $identifierValue
  * @param string $geoIdentifierValue
  * @dataProvider afterGetValueDataProvider
  */
 public function testAfterGetValue($storeId, $identifierValue, $geoIdentifierValue)
 {
     $this->generalConfig->expects($this->once())->method('isAvailable')->willReturn(true);
     $this->storeSwitcher->expects($this->atLeastOnce())->method('getStoreId')->willReturn($storeId);
     /** @var \Magento\Framework\App\PageCache\Identifier $identifier */
     $identifier = $this->getMockBuilder('Magento\\Framework\\App\\PageCache\\Identifier')->disableOriginalConstructor()->getMock();
     $this->assertEquals($geoIdentifierValue, $this->geoIdentifier->afterGetValue($identifier, $identifierValue));
 }