object = new gvHidraTypeBase; } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. * * @access protected */ protected function tearDown() { } /** * @todo Implement testSetRequired(). */ public function testSetRequired() { $this->assertFalse($this->object->getRequired(),'por defecto false'); $this->object->setRequired(true); $this->assertTrue($this->object->getRequired(),'cambiar a true'); } /** * @todo Implement testGetRequired(). */ public function testGetRequired() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetMaxLength(). */ public function testSetMaxLength() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetMaxLength(). */ public function testGetMaxLength() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testEnableInputMask(). */ public function testEnableInputMask() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetStatusInputMask(). */ public function testGetStatusInputMask() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testEnableServerValidation(). */ public function testEnableServerValidation() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetStatusServerValidation(). */ public function testGetStatusServerValidation() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * comprobar requeridos vacios */ public function testValidate() { $txt = 'Es un campo obligatorio.'; $this->object->setRequired(true); // si debe dar error de required foreach (array('',"",null,) as $val) { try { $this->object->validate($val); } catch (Exception $e) { if ($e->getMessage()!=$txt) $this->fail('hay otra excepcion pero no la de required: '.$e->getMessage()); continue; } $this->fail('valor '.var_export($val,true).' no pasa el required'); } } /** * comprobar requeridos vacios */ public function testValidate2() { $txt = 'Es un campo obligatorio.'; $this->object->setRequired(true); // no debe dar error de required foreach (array(0,'0','algo',' ',1234) as $val) { try { $this->object->validate($val); } catch (Exception $e) { if ($e->getMessage()==$txt) $this->fail('el valor '.var_export($val,true).' no pasa la validacion de required'); } } } } ?>