Easy PHP question!

Associate
Joined
2 Oct 2003
Posts
2,121
Location
Chester
Can't figure this out so early in the morning :p

I've started learning PHPUnit. Each function creates a new object called joe. But following DRY principles, I only want to create the single object - not sure where to instantiate the class?

PHP:
<?php

require_once('CustomerController.php');

class CustomerTest extends PHPUnit_Framework_TestCase {

	public function testGetFirstName()
	{
		$joe = new Customer('Joe', 'Smith');
		$this->assertEquals('Joe', $joe->getFirstName());
	}
	
	public function testGetLastName()
	{
		$joe = new Customer('Joe', 'Smith');
		$this->assertEquals('Smith', $joe->getLastName());
	}
}
?>
 
Back
Top Bottom