Ejemplo n.º 1
0
Archivo: unit.php Proyecto: ssrsfs/blg
 public function testEmailValidation()
 {
     /** Assertions:
      * Check responses to a list of valid and invalid email addresses
      */
     $field = new Form_Field_Email();
     // Valid emails
     $field->validate('*****@*****.**', 'Email');
     $this->assertFalse($field->error(), "{$field->input()} should not have returned an error");
     $field->validate('*****@*****.**', 'Email');
     $this->assertFalse($field->error(), "{$field->input()} should not have returned an error");
     $field->validate('*****@*****.**', 'Email');
     // Invalid emails
     $this->assertFalse($field->error(), "{$field->input()} should not have returned an error");
     $field->validate('nodomain', 'Email');
     $this->assertTrue($field->error(), "{$field->input()} should have returned an error");
     $field->validate('invalidseparator+domain.com', 'Email');
     $this->assertTrue($field->error(), "{$field->input()} should have returned an error");
 }