PHP Classes
elePHPant
Icontem

File: dao.test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Georgi Momchilov  >  DAO  >  dao.test.php  >  Download  
File: dao.test.php
Role: Unit test script
Content type: text/plain
Description: test file - uses gUnit to test
Class: DAO
Database access wrapper providing query queueing
Author: By
Last change: Important bug fixes
Date: 8 years ago
Size: 1,069 bytes
 

Contents

Class file image Download
<?php
require_once ('alerter/alerter.class.php');
require_once (
'dao.class.php');
require_once (
'gunit/gunit.class.php');


class
daoTest extends GUnit {
    function
testConnect(){
       
$o = new dao();
        return
$o->connect();
    }
   
    function
testInsertQuery(){
       
$o = new dao();
       
$o->connect();
        return
$o->query("INSERT INTO `test` SET `descr` = 'adasd', `date` = 'asd'" );
    }
   
    function
testSelectQuery(){
       
$o = new dao();
       
$o->connect();
        return (
is_array( $o->query('SELECT * FROM `test`') ) == true ) ? true : false;
    }
   
    function
testQueueSQL(){
       
$o = new dao();
        return
$o->queueSQL( 'UPDATE `test` SET `descr` = "ggg"', 'queue.sql' );
    }
   
    function
testExecuteQueue(){
       
$o = new dao();
        return
$o->executeQueue( 'queue.sql' );
    }
   
    function
testDeleteQuery(){
       
$o = new dao();
       
$o->connect();
        return
$o->query('DELETE FROM `test`');
    }
      
}

$o = new daoTest;
$o->run();
?>