Esempio n. 1
0
<?php

$o = new weeEmailValidator();
$o->setValue($sEmail);
if ($o->hasError()) {
    echo $o->getError();
} else {
    doSomething($sEmail);
}
// valid
Esempio n. 2
0
File: email.php Progetto: extend/wee
<?php

class CastableInput_testEmailValidator
{
    public function __toString()
    {
        return '*****@*****.**';
    }
}
// weeEmailValidator should throw a DomainException when the value to validate is neither a string, an instance of Printable or an object castable to string.
$o = new weeEmailValidator();
try {
    $o->setValue(new stdClass());
    $this->fail(_WT('weeEmailValidator should throw a DomainException when the value is an object which is neither an instance of Printable nor an object castable to string.'));
} catch (DomainException $e) {
}
try {
    $o->setValue(true);
    $this->fail(_WT('weeEmailValidator should throw a DomainException when the value is a boolean.'));
} catch (DomainException $e) {
}
try {
    $o->setValue(null);
    $this->fail(_WT('weeEmailValidator should throw a DomainException when the value is null.'));
} catch (DomainException $e) {
}
try {
    $o->setValue(array());
    $this->fail(_WT('weeEmailValidator should throw a DomainException when the value is an array.'));
} catch (DomainException $e) {
}