public function testTriggerError()
{
try {
$document = new \Sokil\Mongo\Document($this->collection);
$document->triggerError('field', 'rule', 'message');
$document->validate();
$this->fail('\\Sokil\\Mongo\\Document\\InvalidDocumentException must be thrown, no exception captured');
} catch (\Sokil\Mongo\Document\InvalidDocumentException $e) {
$this->assertEquals(array('field' => array('rule' => 'message')), $document->getErrors());
} catch (\Exception $e) {
$this->fail('\\Sokil\\Mongo\\Document\\InvalidDocumentException expected, ' . get_class($e) . ' found');
}
}