public function Test_of_validatesExclusionOf() { $Person = new TestPerson(); $Person->validatesExclusionOf('gender', array('too much'), "don't lie"); $this->assertEqual($Person->getErrorsOn('gender'), "don't lie"); $Person->clearErrors(); $Person->gender = 'too much'; $Person->validatesExclusionOf('gender', array('too much'), "don't lie"); $this->assertEqual($Person->getErrorsOn('gender'), "don't lie"); $Person->clearErrors(); $Person->gender = 'male'; $Person->validatesExclusionOf('gender', array('too much'), "don't lie"); $this->assertFalse($Person->hasErrors()); $Person->clearErrors(); unset($Person->gender); $Person->validatesExclusionOf('gender', array('too much'), "don't lie", true); $this->assertFalse($Person->hasErrors()); $Person->clearErrors(); $Person->age = 17; $Person->validatesExclusionOf('age', range(18, 120)); $this->assertFalse($Person->hasErrors()); $Person->clearErrors(); $Person->age = 121; $Person->validatesExclusionOf('age', range(18, 120)); $this->assertFalse($Person->hasErrors()); $Person->clearErrors(); $Person->age = 18; $Person->validatesExclusionOf('age', range(18, 120)); $this->assertEqual($Person->getErrorsOn('age'), $Person->getDefaultErrorMessageFor('exclusion')); }