function testFilterDoesNoActionIfMinAndMaxNotPresentButValid() { $filter = new T_Validate_IsNumericRange('min', 'max'); $test = new T_Form_Fieldset('container', 'label'); $min = new T_Test_Form_ElementStub('min', 'label'); $min->setOptional(); $test->addChild($min); $max = new T_Test_Form_ElementStub('max', 'label'); $max->setOptional(); $test->addChild($max); $test->validate(new T_Cage_Array(array())); $filter->transform($test); $this->assertTrue($test->isValid()); }
function testFilterDoesNoActionIfMasterAndSlaveNotPresentButValid() { $filter = new T_Validate_Confirm('master', 'slave'); $test = new T_Form_Fieldset('container', 'label'); $master = new T_Test_Form_ElementStub('master', 'label'); $master->setOptional(); $test->addChild($master); $slave = new T_Test_Form_ElementStub('slave', 'label'); $slave->setOptional(); $test->addChild($slave); $test->validate(new T_Cage_Array(array())); $filter->transform($test); $this->assertTrue($test->isValid()); }
function testCollectionIsNotValidWithLastChildInvalid() { $input = $this->getInputCollection('parent', 'mylabel'); $child1 = new T_Test_Form_ElementStub('child1', 'label'); $child1->setOptional(); $child2 = new T_Test_Form_ElementStub('child2', 'label'); $input->addChild($child1)->addChild($child2); $input->validate(new T_Cage_Array(array('parent' => ''))); $this->assertFalse($input->isValid()); }