Login   Register  
PHP Classes
elePHPant
Icontem

File: unit-test/input_name_param.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/input_name_param.test.php  >  Download  
File: unit-test/input_name_param.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: 1 year ago
Size: 1,363 bytes
 

Contents

Class file image Download
<?php

class InputNameParamTest extends PHPUnit_Framework_TestCase {

    public function 
setUp() {
        
$this->rules = array(
            
'test1' => array('equals(:test2)')
        );
    }

    public function 
testValidInputs() {
        
$inputs = array(
            
'test1' => 'foo',
            
'test2' => 'foo'
        
);
        
$validation_result SimpleValidator\Validator::validate($inputs$this->rules);
        
$this->assertTrue($validation_result->isSuccess());
    }

    public function 
testInvalidInputs() {
        
$inputs = array(
            
'test1' => 'foo',
            
'test2' => 'foo2'
        
);
        
$validation_result SimpleValidator\Validator::validate($inputs$this->rules);
        
$this->assertFalse($validation_result->isSuccess());
    }

    public function 
testNullParameterNameInputs() {
        
$inputs = array(
            
'test1' => 'foo'
        
);
        
$validation_result SimpleValidator\Validator::validate($inputs$this->rules);
        
$this->assertFalse($validation_result->isSuccess());
    }

    public function 
testEmptyParameterNameInputs() {
        
$inputs = array(
            
'test1' => 'foo',
            
'test2' => ''
        
);
        
$validation_result SimpleValidator\Validator::validate($inputs$this->rules);
        
$this->assertFalse($validation_result->isSuccess());
    }

}

?>