protected function canReplaceImageWithSwatch($expected) { $this->swatchesHelperMock->expects($this->once())->method('isSwatchAttribute')->with($this->attributeMock)->willReturn($expected['isSwatchAttribute']); $this->attributeMock->expects($this->exactly($expected['getUsedInProductListing_count']))->method('getUsedInProductListing')->willReturn($expected['getUsedInProductListing']); $this->attributeMock->expects($this->exactly($expected['getIsFilterable_count']))->method('getIsFilterable')->willReturn($expected['getIsFilterable']); if ($expected['update_product_preview_image__count'] == 1) { $this->attributeMock->method('getData')->with('update_product_preview_image')->willReturn($expected['update_product_preview_image']); } }
/** * @dataProvider dataIsSwatchAttribute */ public function testIsSwatchAttribute($times, $swatchType, $boolResult) { $this->attributeMock->method('hasData')->with('swatch_input_type')->willReturn(true); $this->attributeMock->expects($this->exactly($times))->method('getData')->with('swatch_input_type')->willReturn($swatchType); $result = $this->swatchHelperObject->isSwatchAttribute($this->attributeMock); if ($boolResult) { $this->assertTrue($result); } else { $this->assertFalse($result); } }