public function testTriggerErrors()
{
$errors = array('field1' => array('rule1' => 'message1'), 'field2' => array('rule2' => 'message2'));
try {
$document = new \Sokil\Mongo\Document($this->collection);
$document->triggerErrors($errors);
$document->validate();
$this->fail('\\Sokil\\Mongo\\Document\\InvalidDocumentException must be thrown, no exception captured');
} catch (\Sokil\Mongo\Document\InvalidDocumentException $e) {
$this->assertEquals($errors, $document->getErrors());
} catch (\Exception $e) {
$this->fail('\\Sokil\\Mongo\\Document\\InvalidDocumentException expected, ' . get_class($e) . ' found');
}
}