예제 #1
0
 public function Test_of_addErrorOnBoundaryBreaking()
 {
     $Person = new TestPerson();
     $Person->set('age', 17);
     $Person->addErrorOnBoundaryBreaking('age', 18, 65, 'too old', 'too young');
     $expected = array('age' => array('too young'));
     $this->assertEqual($Person->getErrors(), $expected);
     $Person = new TestPerson();
     $Person->set('age', 66);
     $Person->addErrorOnBoundaryBreaking('age', 18, 65, 'too old', 'too young');
     $expected = array('age' => array('too old'));
     $this->assertEqual($Person->getErrors(), $expected);
     $Person = new TestPerson();
     $Person->set('age', 65);
     $Person->addErrorOnBoundaryBreaking('age', 18, 65, 'too old', 'too young');
     $Person->set('age', 18);
     $Person->addErrorOnBoundaryBreaking('age', 18, 65, 'too old', 'too young');
     $this->assertEqual($Person->getErrors(), array());
 }