/** * @param string $path a path to a image file - convenient way to open an image without using the load() method * @param ImageResourceInterface $resource A valid object implementing the ImageResourceInterface; defaults to null, * in which case a resource will be automatically created based on current extensions available */ public function __construct($path = null, ImageResourceInterface $resource = null) { $this->drawer = new Drawer(); if (!$resource) { $provider = new ResourceProvider(); $resource = $provider->createImageResource(); } $this->resource = $resource; if ($this->resource instanceof ImageFilterableInterface) { $this->filterResolver = new FilterResolver($this->resource->loadFilters()); } if ($path) { $this->load($path); } return $this; }
public function testShouldReturnImagickResource() { $this->PhpExtensionAvailabilityChecker->shouldReceive('isLoaded')->with('imagick')->andReturn(true); $this->assertInstanceOf('Imanee\\ImageResource\\ImagickResource', $this->resourceProvider->createImageResource()); }