echo "Values:\n"; var_dump(3.14); var_dump(2.72); ?> </td> <td> <pre> <?php $def = array('test1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'float'), 'test2' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'float')); $form = new ezcInputForm(INPUT_POST, $def); echo "Valid properties:\n"; var_dump($form->getValidProperties()); echo "Required properties:\n"; var_dump($form->getRequiredProperties()); echo "Optional properties:\n"; var_dump($form->getOptionalProperties()); echo "isValid:\n"; var_dump($form->isValid()); echo "Values:\n"; var_dump($form->test1); var_dump($form->test2); ?> </td> </tr> </table> </body> </html> <?php } else { ?> <form method="post" align="center">
public function testOptionalProperties() { $def = array('test2' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'test3' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int')); $obj = new ezcInputForm(INPUT_GET, $def); $expectedArray = array('test2', 'test3'); self::assertEquals($expectedArray, $obj->getOptionalProperties()); self::assertEquals(array(), $obj->getRequiredProperties()); }