setImagick() public method

Set an Imagick instance
public setImagick ( Imagick $imagick ) : self
$imagick Imagick An instance of Imagick
return self
Example #1
0
 /**
  * @dataProvider getFilterData
  * @covers Imbo\EventListener\ExifMetadata::setImagick
  * @covers Imbo\EventListener\ExifMetadata::getImagick
  * @covers Imbo\EventListener\ExifMetadata::populate
  * @covers Imbo\EventListener\ExifMetadata::save
  * @covers Imbo\EventListener\ExifMetadata::filterProperties
  * @covers Imbo\EventListener\ExifMetadata::parseProperties
  */
 public function testCanFilterData($data, $tags, $expectedData)
 {
     $user = '******';
     $imageIdentifier = 'imageIdentifier';
     $blob = 'blob';
     $image = $this->getMock('Imbo\\Model\\Image');
     $image->expects($this->once())->method('getImageIdentifier')->will($this->returnValue($imageIdentifier));
     $image->expects($this->once())->method('getBlob')->will($this->returnValue($blob));
     $imagick = $this->getMock('Imagick');
     $imagick->expects($this->once())->method('readImageBlob')->will($this->returnValue($blob));
     $imagick->expects($this->once())->method('getImageProperties')->will($this->returnValue($data));
     $request = $this->getMock('Imbo\\Http\\Request\\Request');
     $request->expects($this->once())->method('getUser')->will($this->returnValue($user));
     $request->expects($this->any())->method('getImage')->will($this->returnValue($image));
     $database = $this->getMock('Imbo\\Database\\DatabaseInterface');
     $database->expects($this->once())->method('updateMetadata')->with($user, $imageIdentifier, $expectedData);
     $event = $this->getMock('Imbo\\EventManager\\Event');
     $event->expects($this->exactly(2))->method('getRequest')->will($this->returnValue($request));
     $event->expects($this->once())->method('getDatabase')->will($this->returnValue($database));
     $listener = new ExifMetadata(['allowedTags' => $tags]);
     $listener->setImagick($imagick);
     $listener->populate($event);
     $listener->save($event);
 }
Example #2
0
 /**
  * @dataProvider getFilterData
  * @covers Imbo\EventListener\ExifMetadata::setImagick
  * @covers Imbo\EventListener\ExifMetadata::getImagick
  * @covers Imbo\EventListener\ExifMetadata::populate
  * @covers Imbo\EventListener\ExifMetadata::save
  * @covers Imbo\EventListener\ExifMetadata::filterProperties
  * @covers Imbo\EventListener\ExifMetadata::parseProperties
  */
 public function testCanFilterData($data, $tags, $expectedData)
 {
     $publicKey = 'publickey';
     $checksum = 'checksum';
     $blob = 'blob';
     $image = $this->getMock('Imbo\\Model\\Image');
     $image->expects($this->once())->method('getChecksum')->will($this->returnValue($checksum));
     $image->expects($this->once())->method('getBlob')->will($this->returnValue($blob));
     $imagick = $this->getMock('Imagick');
     $imagick->expects($this->once())->method('readImageBlob')->will($this->returnValue($blob));
     $imagick->expects($this->once())->method('getImageProperties')->will($this->returnValue($data));
     $request = $this->getMock('Imbo\\Http\\Request\\Request');
     $request->expects($this->once())->method('getPublicKey')->will($this->returnValue($publicKey));
     $request->expects($this->exactly(2))->method('getImage')->will($this->returnValue($image));
     $database = $this->getMock('Imbo\\Database\\DatabaseInterface');
     $database->expects($this->once())->method('updateMetadata')->with($publicKey, $checksum, $expectedData);
     $event = $this->getMock('Imbo\\EventManager\\Event');
     $event->expects($this->exactly(2))->method('getRequest')->will($this->returnValue($request));
     $event->expects($this->once())->method('getDatabase')->will($this->returnValue($database));
     $listener = new ExifMetadata(array('allowedTags' => $tags));
     $listener->setImagick($imagick);
     $listener->populate($event);
     $listener->save($event);
 }