ImboIntegrationTest\EventListener\ExifMetadataTest::testCanGetAndSaveProperties PHP Метод

testCanGetAndSaveProperties() публичный Метод

    public function testCanGetAndSaveProperties()
    {
        $listener = new ExifMetadata();
        $user = 'foobar';
        $imageIdentifier = 'imageId';
        $image = new Image();
        $image->setBlob(file_get_contents(FIXTURES_DIR . '/exif-logo.jpg'));
        $image->setImageIdentifier($imageIdentifier);
        $request = $this->getMock('Imbo\\Http\\Request\\Request');
        $request->expects($this->exactly(2))->method('getImage')->will($this->returnValue($image));
        $request->expects($this->once())->method('getUser')->will($this->returnValue($user));
        $database = $this->getMock('Imbo\\Database\\DatabaseInterface');
        $database->expects($this->once())->method('updateMetadata')->with($this->equalTo($user), $this->equalTo($imageIdentifier), $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);
    }