PHPUnit

require_once(‘EmailAddress.inc’);

require_once(‘PHPUnit/Framework/TestClass.php’)

class EmailAddressTest extends PHPUnit_Framework_TestCase {

public function __constructor($name) {

parent::__constructor($name)

}

function testLocalPart() {

$email = new EmailAddress(‘george@gmail.com’);

$this->assertTrue($email->localPart == ‘george’);

}

}

// then in TestRunner.php

require_once ‘PHPUnit/Framework/TestSuite’;

$suite = new PHPUnit_Framework_TestSuite();

$suite->addTest(new EmailAddressTest(‘testLocalPart’));

then run it like

require_once ‘PHPUnit/TestUI/TestRunner’;

PHPUnit_TextUI_TestRunner::run($suite);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s