Location: PHPKode > projects > SolarPHP > solar-system-1.1.1/solar/source/solar/tests/Test/Solar/Filter/ValidateEmail.php
<?php
/**
 * 
 * Concrete class test.
 * 
 */
class Test_Solar_Filter_ValidateEmail extends Test_Solar_Filter_Abstract {
    
    /**
     * 
     * Configuration values.
     * 
     * @var array
     * 
     */
    protected $_Test_Solar_Filter_ValidateEmail = array(
    );
    
    /**
     * 
     * Test -- Validates that the value is an email address.
     * 
     */
    public function testValidateEmail()
    {
        $test = array(
            "hide@address.com",
            "hide@address.com",
            "any-hide@address.com",
            "hide@address.com",
            "hide@address.com",
            "something+hide@address.com",
        );
        foreach ($test as $val) {
            $this->assertTrue($this->_filter->validateEmail($val));
        }
    }
    
    public function testValidateEmail_badOrBlank()
    {
        $test = array(
            "something @ somewhere.edu",
            "the-name.for!you",
            "non:hide@address.com",
            "",
            "\t\n",
            " ",
        );
        foreach ($test as $val) {
            $this->assertFalse($this->_filter->validateEmail($val));
        }
    }
    
    public function testValidateEmail_notRequired()
    {
        $this->_filter->setRequire(false);
        $test = array(
            "",
            "\t\n",
            " ",
            "hide@address.com",
            "hide@address.com",
            "any-hide@address.com",
            "hide@address.com",
            "hide@address.com",
        );
        foreach ($test as $val) {
            $this->assertTrue($this->_filter->validateEmail($val));
        }
    }
}
Return current item: SolarPHP