6 declare(strict_types=1);
44 $this->swatchType->isSwatchAttribute(
45 $this->createAttributeMock($dataValue)
74 $this->swatchType->isTextSwatch(
75 $this->createAttributeMock($dataValue)
104 $this->swatchType->isVisualSwatch(
105 $this->createAttributeMock($dataValue)
127 public function testIfAttributeHasNotAdditionData() : void
134 $attributeMock = $this->getMockBuilder(AttributeInterface::class)
135 ->disableOriginalConstructor()
136 ->setMethods([
'hasData',
'getData',
'setData'])
137 ->getMockForAbstractClass();
139 $attributeMock->expects($this->any())->method(
'hasData')->willReturn(
false);
141 $attributeMock->expects($this->any())
145 [
'additional_data', $encodedAdditionData],
150 $this->assertEquals(
true, $this->swatchType->isTextSwatch($attributeMock));
151 $this->assertEquals(
false, $this->swatchType->isVisualSwatch($attributeMock));
161 $attributeMock = $this->getMockBuilder(AttributeInterface::class)
162 ->disableOriginalConstructor()
163 ->setMethods([
'hasData',
'getData',
'setData'])
164 ->getMockForAbstractClass();
166 $attributeMock->expects($this->any())->method(
'hasData')->willReturn($hasDataReturns);
167 $attributeMock->expects($this->any())->method(
'getData')->willReturn($getDataReturns);
169 return $attributeMock;
provideIsSwatchAttributeTestData()
testIsVisualSwatch(string $dataValue, bool $expected)
const SWATCH_INPUT_TYPE_TEXT
testIsSwatchAttribute(string $dataValue, bool $expected)
createAttributeMock($getDataReturns, bool $hasDataReturns=true)
provideIsTextSwatchAttributeTestData()
const SWATCH_INPUT_TYPE_KEY
provideIsVisualSwatchAttributeTestData()
const SWATCH_INPUT_TYPE_VISUAL
testIsTextSwatch(string $dataValue, bool $expected)