/** * @covers Imbo\Database\MongoDB::updateMetadata * @expectedException Imbo\Exception\DatabaseException * @expectedExceptionMessage Unable to update meta data * @expectedExceptionCode 500 */ public function testThrowsExceptionWhenMongoFailsDuringUpdateMetadata() { $this->imageCollection->expects($this->once())->method('findOne')->will($this->returnValue(['some' => 'data'])); $this->imageCollection->expects($this->once())->method('update')->will($this->throwException(new MongoException())); $this->driver->updateMetadata('key', 'identifier', ['key' => 'value']); }