コード例 #1
0
 public function testSaveFile()
 {
     $imageProcessor = $this->getMockBuilder('Magento\\Framework\\Image')->disableOriginalConstructor()->getMock();
     $this->image->setImageProcessor($imageProcessor);
     $this->coreFileHelper->expects($this->once())->method('saveFile')->will($this->returnValue(true));
     $absolutePath = dirname(dirname(__DIR__)) . '/_files/catalog/product/somefile.png';
     $this->mediaDirectory->expects($this->once())->method('getAbsolutePath')->will($this->returnValue($absolutePath));
     $this->image->saveFile();
 }
コード例 #2
0
 /**
  * @param \Magento\Catalog\Model\Product\Image $model
  * @depends testSetBaseFilePlaceholder
  */
 public function testSaveFilePlaceholder($model)
 {
     $processor = $this->getMock('Magento\\Framework\\Image', ['save'], [], '', false);
     $processor->expects($this->exactly(0))->method('save');
     $model->setImageProcessor($processor)->saveFile();
 }