Example #1
0
 public function testChangeDefinition()
 {
     $this->form->addDefinition('foo', array('min' => 3));
     $this->form->foo = 'abc';
     $this->assertEquals(0, count($this->form->validate()->getErrors()));
     $this->form->clearErrors();
     $this->form->foo = 'ab';
     $this->assertEquals(1, count($this->form->validate()->getErrors()));
     $this->form->clearErrors();
     $this->form->changeDefinition('foo', array('min' => 5));
     $this->form->foo = 'abcd';
     $this->assertEquals(1, count($this->form->validate()->getErrors()));
     $this->form->clearErrors();
     $this->form->foo = 'abcde';
     $this->assertEquals(0, count($this->form->validate()->getErrors()));
     $this->form->clearErrors();
 }