Login   Register  
PHP Classes
elePHPant
Icontem

File: unit-test/alpha.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/alpha.test.php  >  Download  
File: unit-test/alpha.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: 993 bytes
 

Contents

Class file image Download
<?php

class AlphaTest extends PHPUnit_Framework_TestCase {

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

    public function 
tearDown() {
        
    }

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

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

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

}

?>