Creating a PHPUnit test case
<?php
    
class EmailAddressTest extends PHPUnit_TestCase{
        
        function 
EmailAddressTest($name) {
            
PHPUnit_TestCase::PHPUnit_TestCase($name);
        }
    
            
        function 
testLocalPart() {
            
$email = new EmailAddress("john@php.net");
            
            
// check that the local part of the address 
            // is equal to 'john'
            
$this->assertTrue($email->localPart == 'john');
        }
 
        function 
testDomain() {
            
            
$email = new EmailAddress("john@php.net");
            
$this->assertTrue($email->domain == 'php.net');
        }
    }
?>