/** * @covers Imbo\Database\MongoDB::getNumImages * @expectedException Imbo\Exception\DatabaseException * @expectedExceptionMessage Unable to fetch information from the database * @expectedExceptionCode 500 */ public function testThrowsExceptionWhenMongoFailsDuringGetNumImages() { $this->imageCollection->expects($this->once())->method('count')->will($this->throwException(new MongoException())); $this->driver->getNumImages('key'); }