Пример #1
0
function testEmail($email)
{
    echo $email;
    $rule = new A_Rule_Email('email', 'error message');
    $pass = $rule->isValid(array('email' => $email));
    if ($pass) {
        echo " is valid.\n";
    } else {
        echo " is not valid.\n";
    }
    return $pass;
}
Пример #2
0
 function testRule_EmailNotNull()
 {
     $dataspace = new A_Collection();
     $rule = new A_Rule_Email('foo', 'foo error');
     $this->assertFalse($rule->isValid($dataspace));
     $dataspace->set('foo', 'test');
     $this->assertFalse($rule->isValid($dataspace));
     // should this rule all this kind of valid address by default?
     $dataspace->set('foo', 'test@test');
     $this->assertTrue($rule->isValid($dataspace));
     $dataspace->set('foo', '*****@*****.**');
     $this->assertTrue($rule->isValid($dataspace));
 }