This listener will look for properties stored in the image, and store them as metadata in Imbo.
Author: Espen Hovlandsdal (espen@hovlandsdal.com)
Author: Christer Edvartsen (cogo@starzinger.net)
Inheritance: implements Imbo\EventListener\ListenerInterface
Beispiel #1
0
 /**
  * @covers Imbo\EventListener\ExifMetadata::__construct
  * @covers Imbo\EventListener\ExifMetadata::populate
  * @covers Imbo\EventListener\ExifMetadata::save
  */
 public function testCanGetAndSaveProperties()
 {
     $listener = new ExifMetadata();
     $publicKey = 'foobar';
     $image = new Image();
     $image->setBlob(file_get_contents(FIXTURES_DIR . '/exif-logo.jpg'));
     $request = $this->getMock('Imbo\\Http\\Request\\Request');
     $request->expects($this->exactly(2))->method('getImage')->will($this->returnValue($image));
     $request->expects($this->once())->method('getPublicKey')->will($this->returnValue($publicKey));
     $database = $this->getMock('Imbo\\Database\\DatabaseInterface');
     $database->expects($this->once())->method('updateMetadata')->with($this->equalTo($publicKey), $this->equalTo('753e11e00522ff1e95600d8f91c74e8e'), $this->arrayHasKey('gps:location'));
     $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));
     $properties = $listener->populate($event);
     $this->assertSame('SAMSUNG', $properties['exif:Make']);
     $this->assertSame('GT-I9100', $properties['exif:Model']);
     $listener->save($event);
 }
Beispiel #2
0
 /**
  * @covers Imbo\EventListener\ExifMetadata::getImagick
  */
 public function testCanInstantiateImagickItself()
 {
     $this->assertInstanceOf('Imagick', $this->listener->getImagick());
 }