/** * @dataProvider isValidAddMessagesCallDataProvider * * @param array $value * @param bool $hasEmptyColumns * @param array $customerGroups * @param array $expectedMessages */ public function testIsValidAddMessagesCall($value, $hasEmptyColumns, $customerGroups, $expectedMessages) { $this->groupPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(true); $this->groupPrice->expects($this->any())->method('hasEmptyColumns')->willReturn($hasEmptyColumns); $this->setPropertyValue($this->groupPrice, 'customerGroups', $customerGroups); $this->groupPrice->expects($this->once())->method('_addMessages')->with($expectedMessages); $this->groupPrice->isValid($value); }
/** * Get customer group id * * @param string $customerGroup * @return int */ protected function getCustomerGroupId($customerGroup) { $customerGroups = $this->groupPriceValidator->getCustomerGroups(); return $customerGroup == self::VALUE_ALL_GROUPS ? 0 : $customerGroups[$customerGroup]; }