Imbo\Database\MongoDB::load PHP Method

load() public method

public load ( $user, $imageIdentifier, Image $image )
$image Imbo\Model\Image
    public function load($user, $imageIdentifier, Image $image)
    {
        $data = $this->getImageProperties($user, $imageIdentifier);
        $image->setWidth($data['width'])->setHeight($data['height'])->setFilesize($data['size'])->setMimeType($data['mime'])->setExtension($data['extension'])->setAddedDate(new DateTime('@' . $data['added'], new DateTimeZone('UTC')))->setUpdatedDate(new DateTime('@' . $data['updated'], new DateTimeZone('UTC')));
        return true;
    }

Usage Example

Beispiel #1
0
 /**
  * @covers Imbo\Database\MongoDB::load
  * @expectedException Imbo\Exception\DatabaseException
  * @expectedExceptionMessage Unable to fetch image data
  * @expectedExceptionCode 500
  */
 public function testThrowsExceptionWhenMongoFailsDuringLoad()
 {
     $this->imageCollection->expects($this->once())->method('findOne')->will($this->throwException(new MongoException()));
     $this->driver->load('key', 'identifier', $this->getMock('Imbo\\Model\\Image'));
 }