public function testIsValidReturnAddMessagesCall() { $value = [AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value']; $allWebsitesValue = 'not tier|group price website value'; $colTierPriceWebsite = false; $expectedMessages = [AdvancedPricing\Validator\Website::ERROR_INVALID_WEBSITE]; $this->website->expects($this->once())->method('_clearMessages'); $this->website->expects($this->any())->method('getAllWebsitesValue')->willReturn($allWebsitesValue); $this->storeResolver->method('getWebsiteCodeToId')->willReturnMap([[$value[AdvancedPricing::COL_TIER_PRICE_WEBSITE], $colTierPriceWebsite]]); $this->website->expects($this->any())->method('_addMessages')->with($expectedMessages); $this->website->isValid($value); }
/** * Get website id by code * * @param string $websiteCode * @return array|int|string */ protected function getWebSiteId($websiteCode) { $result = $websiteCode == $this->websiteValidator->getAllWebsitesValue() || $this->_catalogData->isPriceGlobal() ? 0 : $this->_storeResolver->getWebsiteCodeToId($websiteCode); return $result; }