PHP Classes
Icontem

File: example.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Georgi Momchilov  >  GUnit  >  example.php  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: GUnit
Automate class feature testing
 

Contents

Class file image Download
<?php
require_once 'validator.class.php';
require_once 
'gunit.class.php';
 
class 
ValidatorTest extends GUnit {
    function 
testEmail(){
        
$o = new Validator;
        
$o->setEmail'gmomchilov@gmail.com' );
        return ( 
$o->ValidateEmail() === true ) ? true false;
    }
    
    function 
testFalseEmail(){
        
$o = new Validator;
        
$o->setEmail'gmomchilov@.gmail.comchi' );
        return ( 
$o->ValidateEmail() === false ) ? true false;
    }
    
    function 
testUsername(){
        
$o = new Validator;
        
$o->setUsername'gmomchilov' );
        return ( 
$o->ValidateUsername() === true ) ? true false;
    }  
    
    function 
testFalseUsername(){
        
$o = new Validator;
        
$o->setUsername'^%$DSA@' );
        return ( 
$o->ValidateUsername() === false ) ? true false;
    }  
    
    function 
testPasswords(){
        
$o = new Validator;
        
$o->setPasswords'gmmml''gmmml' );
        return ( 
$o->ValidatePasswords() === true ) ? true false;
    }  
    
    function 
testFalsePasswords(){
        
$o = new Validator;
        
$o->setPasswords'gmmml@''#gmmml' );
        return ( 
$o->ValidatePasswords() === false ) ? true false;
    }
    
    function 
testValidate(){
    
$o = new Validator;
        
$o->setPasswords'gmmmla''gmmmla' );
    
$o->setUsername'gmomchilov' );
    
$o->setEmail'gmomchilov@gmail.com' );
    return ( 
$o->Validate() === true ) ? true false;
    }  
    
    function 
testFalseValidate(){
    
$o = new Validator;
        
$o->setPasswords'mmmla''gmmmla' );
    
$o->setUsername'gmomchilo#v' );
    
$o->setEmail'@gmail.com' );
    return ( 
$o->Validate() === false ) ? true false;
   }
}
$o = new ValidatorTest;
$o->run();
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products