Ejemplo n.º 1
0
 public function testGetOptionValueWithFileInfo()
 {
     $customOption = $this->getMockBuilder('Magento\\Catalog\\Api\\Data\\CustomOptionExtensionInterface')->setMethods(['getFileInfo'])->getMockForAbstractClass();
     $imageContent = $this->getMockBuilder('Magento\\Framework\\Api\\Data\\ImageContentInterface')->getMockForAbstractClass();
     $customOption->expects($this->once())->method('getFileInfo')->willReturn($imageContent);
     $imageResult = ['type' => 'type', 'title' => 'title', 'fullpath' => 'fullpath', 'quote_path' => 'quote_path', 'order_path' => 'order_path', 'size' => 100, 'width' => 100, 'height' => 100, 'secret_key' => 'secret_key'];
     $this->fileProcessor->expects($this->once())->method('processFileContent')->with($imageContent)->willReturn($imageResult);
     $this->model->setExtensionAttributes($customOption);
     $this->model->setData(\Magento\Catalog\Api\Data\CustomOptionInterface::OPTION_VALUE, 'file');
     $this->assertEquals($imageResult, $this->model->getOptionValue());
 }