PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Georgi Momchilov   GUnit   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: GUnit
Automate class feature testing
Author: By
Last change: bugfix
Date: 17 years ago
Size: 1,767 bytes
 

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();
?>