PHP Classes
elePHPant
Icontem

File: ObjectAgentTest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Kevin Burke  >  Scrubs  >  ObjectAgentTest.php  >  Download  
File: ObjectAgentTest.php
Role: Unit test script
Content type: text/plain
Description: Unit Test for Object Agent
Class: Scrubs
Object-relational mapping / Data persistence tool
Author: By
Last change:
Date: 11 years ago
Size: 1,248 bytes
 

Contents

Class file image Download
<?php

/**
 *
 *
 * @version $Id$
 * @copyright 2003
 **/
 
require('phpunit.php');
require(
'ObjectAgent.php');
require(
'../classes/Keyword.php');

class
ObjectAgentTest extends TestCase {
   
    var
$guineaPig = "";
   
    function
setUp() {
       
$this->guineaPig = new Keyword();
    }

    function
testFill() {
       
$oa = new ObjectAgent($this->guineaPig);
       
$data = array('story' => 4, 'keyword' => 'hungry', 'weight' => 10);
       
$keyword = $oa->fill($data);
       
$this->assertEquals($keyword->getStory(), 4, 'should pass');
       
$this->assertEquals($keyword->getKeyword(), 'hungry', 'should pass');
       
$this->assertEquals($keyword->getWeight(), 10, 'should pass');
       
$oa = new ObjectAgent($this->guineaPig);
       
$keyword = $oa->clear($keyword->fields);
       
$data = array();
       
$keyword = $oa->fill($data);
       
print_r($keyword);
       
$this->assertEquals($keyword->getStory(), 4, 'should fail');
       
    }
   
    function
testClear() {
       
$oa = new ObjectAgent($this->guineaPig);
       
$keyword = $oa->clear($keyword->fields);
       
$this->assertEquals($keyword->getStory(), '', 'should pass');
       
$this->assertEquals($keyword->getKeyword(), '', 'should pass');
       
$this->assertEquals($keyword->getWeight(), '', 'should pass');
    }
}

?>