A MongoDB database driver for Imbo
Valid parameters for this driver:
- (string) databaseName Name of the database. Defaults to 'imbo'
- (string) server The server string to use when connecting to MongoDB. Defaults to
'mongodb://localhost:27017'
- (array) options Options to use when creating the MongoClient instance. Defaults to
['connect' => true, 'connectTimeoutMS' => 1000].
/** * @covers Imbo\Database\MongoDB::getImageMimeType * @expectedException Imbo\Exception\DatabaseException * @expectedExceptionMessage Unable to fetch image meta data * @expectedExceptionCode 500 */ public function testThrowsExceptionWhenMongoFailsDuringGetImageMimeType() { $this->imageCollection->expects($this->once())->method('findOne')->will($this->throwException(new MongoException())); $this->driver->getImageMimeType('key', 'identifier'); }
/** * @covers Imbo\Database\MongoDB::getStatus */ public function testReturnsFalseWhenFetchingStatusAndTheHostnameIsNotCorrect() { $db = new MongoDB(array('server' => 'foobar')); $this->assertFalse($db->getStatus()); }