Creates a new ImageInterface instance from the given image at the provided path.
public static open ( |
||
$image | Path to an image on the disk. | |
리턴 | Webiny\Component\Image\ImageInterface |
public function testOpen() { // build File mock $file = $this->getMockBuilder('\\Webiny\\Component\\Storage\\File\\File')->disableOriginalConstructor()->setMethods(['getAbsolutePath', 'getKey'])->getMock(); // getAbsolutePath mock $file->expects($this->any())->method('getAbsolutePath')->will($this->returnValue(__DIR__ . '/image.gif')); // getKey mock $file->expects($this->once())->method('getKey')->will($this->returnValue(__DIR__ . '/image.gif')); $image = ImageLoader::open($file); $this->assertInstanceOf('\\Webiny\\Component\\Image\\ImageInterface', $image); }
public function provideImage() { Image::setConfig(realpath(__DIR__ . '/../../' . self::CONFIG)); // build File mock $file = $this->getMockBuilder('\\Webiny\\Component\\Storage\\File\\File')->disableOriginalConstructor()->setMethods(['getAbsolutePath', 'getKey'])->getMock(); // getAbsolutePath mock $file->expects($this->any())->method('getAbsolutePath')->will($this->returnValue(__DIR__ . '/../../image.gif')); // getKey mock $file->expects($this->once())->method('getKey')->will($this->returnValue(__DIR__ . '/../../image.gif')); $image = ImageLoader::open($file); return [[$image]]; }