public function testGetThumbnailPath() { $image = 'image_name.jpg'; $thumbnailPath = '/' . implode('/', array(\Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE, \Magento\Theme\Model\Wysiwyg\Storage::THUMBNAIL_DIRECTORY, $image)); $this->customization->expects($this->any())->method('getCustomizationPath')->will($this->returnValue($this->customizationPath)); $this->directoryWrite->expects($this->any())->method('isExist')->will($this->returnValue(true)); $this->assertEquals($thumbnailPath, $this->helper->getThumbnailPath($image)); }
/** * @test * @return void * @expectedException \InvalidArgumentException * @expectedExceptionMessage The image not found */ public function testGetThumbnailPathNotFound() { $image = 'notFoundImage.png'; $root = '/image'; $sourceNode = '/not/a/root'; $node = base64_encode($sourceNode); $this->request->expects($this->at(0))->method('getParam')->willReturnMap([[\Magento\Theme\Helper\Storage::PARAM_THEME_ID, null, 6], [\Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE, null, \Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE], [\Magento\Theme\Helper\Storage::PARAM_NODE, null, $node]]); $this->urlDecoder->expects($this->once())->method('decode')->with($node)->willReturnCallback(function ($path) { return base64_decode($path); }); $this->directoryWrite->expects($this->once())->method('isDirectory')->with($root . $sourceNode)->willReturn(true); $this->directoryWrite->expects($this->once())->method('getRelativePath')->with($root . $sourceNode)->willReturn($sourceNode); $this->directoryWrite->expects($this->once())->method('isExist')->with($sourceNode . '/' . $image); $this->helper->getThumbnailPath($image); }