/** * @dataProvider dataForTest */ public function testBeforeGetImage($expected) { $this->productMock->expects($this->once())->method('getTypeId')->willReturn('configurable'); $this->requestMock->expects($this->once())->method('getParams')->willReturn($expected['getParams']); $this->getFilterArray($expected); $this->canReplaceImageWithSwatch($expected); $this->swatchesHelperMock->expects($this->exactly($expected['loadVariationByFallback_count']))->method('loadVariationByFallback')->willReturn($expected['product']); $productImageMock = $this->getMock('Magento\\Catalog\\Block\\Product\\AbstractProduct', [], [], '', false); $result = $this->pluginModel->beforeGetImage($productImageMock, $this->productMock, $expected['page_handle']); $this->assertEquals([$this->productMock, $expected['page_handle'], []], $result); }