/** * @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')); }