Beispiel #1
0
 /**
  * Marque le champ en erreur
  *
  * @param Field   $field Champ responçable de l'erreur
  * @param boolean $throw Lancer une exception si champ ignoré oui/non
  *
  * @return void
  * @throws Internal si l'erreur ne doit pas être marqué
  */
 protected function markError(Field $field, $throw = true)
 {
     if ($field->isRequired() === true) {
         return $this->throwError($field);
     }
     if ($throw === true) {
         throw new Internal('Ignore field');
     }
 }
Beispiel #2
0
 /**
  * Gestion des règles
  *
  * @return void
  */
 public function testSetRule()
 {
     $this->if($conf = new TestClass('id'))->object($conf->setRule('test', 'VarInt|notEmpty'))->isIdenticalTo($conf)->object($conf->setRule('obligatoire', true))->isIdenticalTo($conf)->object($conf->setRule('erreur', true))->isIdenticalTo($conf)->object($conf->setRule('renomme', true))->isIdenticalTo($conf)->object($conf->setRule('designe', true))->isIdenticalTo($conf)->object($conf->setRule('exception', true))->isIdenticalTo($conf)->object($conf->setRule('force', true))->isIdenticalTo($conf)->object($conf->setRule('egal', true))->isIdenticalTo($conf)->exception(function () use($conf) {
         $conf->setRule('maRègleFoireuse', -1);
     })->hasMessage('maRègleFoireuse n\'est pas une règle formulaire')->isInstanceOf('\\Solire\\Form\\Exception');
 }