Exemplo n.º 1
0
 /**
  * @dataProvider dataForFullPath
  */
 public function testGetSwatchAttributeImage($swatchType, $expectedResult)
 {
     $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($this->storeMock);
     $this->storeMock->expects($this->once())->method('getBaseUrl')->with('media')->willReturn('http://url/pub/media/');
     $this->generateImageConfig();
     $this->testGenerateSwatchVariations();
     $result = $this->mediaHelperObject->getSwatchAttributeImage($swatchType, '/f/i/file.png');
     $this->assertEquals($result, $expectedResult);
 }
 /**
  * Retrieve Swatch data for config
  *
  * @param array $swatchDataArray
  * @return array
  */
 protected function extractNecessarySwatchData(array $swatchDataArray)
 {
     $result['type'] = $swatchDataArray['type'];
     if ($result['type'] == Swatch::SWATCH_TYPE_VISUAL_IMAGE && !empty($swatchDataArray['value'])) {
         $result['value'] = $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_IMAGE_NAME, $swatchDataArray['value']);
         $result['thumb'] = $this->swatchMediaHelper->getSwatchAttributeImage(Swatch::SWATCH_THUMBNAIL_NAME, $swatchDataArray['value']);
     } else {
         $result['value'] = $swatchDataArray['value'];
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * @param string $type
  * @param string $filename
  * @return string
  */
 public function getSwatchPath($type, $filename)
 {
     $imagePath = $this->mediaHelper->getSwatchAttributeImage($type, $filename);
     return $imagePath;
 }