Login   Register  
PHP Classes
elePHPant
Icontem

File: unit-test/email.test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Can Gelis  >  Simple PHP Validation class  >  unit-test/email.test.php  >  Download  
File: unit-test/email.test.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: Simple PHP Validation class
Validate string value according to different rules
Author: By
Last change: Merge branch 'master' of github.com:cangelis/simple-validator.git
Date: 2013-05-06 07:01
Size: 1,250 bytes
 

Contents

Class file image Download
<?php

class EmailTest extends PHPUnit_Framework_TestCase {

    public function 
setUp() {
        
$this->rules = array(
            
'test' => array('email')
        );
    }

    public function 
tearDown() {
        
    }

    public function 
testValidEmail() {
        
$inputs = array('test' => 'geliscan@gmail.com');
        
$validation_result SimpleValidator\Validator::validate($inputs$this->rules);
        
$this->assertEquals($validation_result->isSuccess(), true);
    }

    public function 
testInvalidEmail() {
        
$inputs = array('test' => 'SimpleValidator');
        
$validation_result SimpleValidator\Validator::validate($inputs$this->rules);
        
$this->assertEquals($validation_result->isSuccess(), false);
    }

    public function 
testEmptyInput() {
        
$inputs = array(
            
'test' => ''
        
);
        
$validator SimpleValidator\Validator::validate($inputs$this->rules);
        
$this->assertEquals($validator->isSuccess(), false);
    }

    public function 
testNullInput() {
        
$inputs = array(
            
'test' => null
        
);
        
$validator SimpleValidator\Validator::validate($inputs$this->rules);
        
$this->assertEquals($validator->isSuccess(), false);
    }

}

?>