Location: PHPKode > scripts > Scrubs > scrubs/ObjectAgentTest.php
<?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');		
	}
}

?>
Return current item: Scrubs