PHPUnit_TestCase($name); } function setUp() { require dirname(__FILE__) . '/_config.inc.php'; require_once '../lib/Email.inc.php'; $this->Email =& new Email(); } function tearDown() { unset($this->Email); } // function testsetparam() // { // $result = $this->Email->setparam(PARAM); // $expected = EXPECTED_VAL; // $this->assertEquals($expected, $result); // } // // function testgetparam() // { // $result = $this->Email->getparam(PARAM); // $expected = EXPECTED_VAL; // $this->assertEquals($expected, $result); // } // // function testsettemplate() // { // $result = $this->Email->settemplate(PARAM); // $expected = EXPECTED_VAL; // $this->assertEquals($expected, $result); // } // // function testsetstring() // { // $result = $this->Email->setstring(PARAM); // $expected = EXPECTED_VAL; // $this->assertEquals($expected, $result); // } // // function testreplace() // { // $result = $this->Email->replace(PARAM); // $expected = EXPECTED_VAL; // $this->assertEquals($expected, $result); // } // // function testsend() // { // $result = $this->Email->send(PARAM); // $expected = EXPECTED_VAL; // $this->assertEquals($expected, $result); // } function testvalidemail() { $testpool = file('_email_test_addresses.txt'); $gc = 0; $bc = 0; $good = array(); $bad = array(); if (is_array($testpool) && !empty($testpool)) { foreach ($testpool as $a) { if ($this->Email->validEmail($a)) { $good[] = trim($a); $gc++; } else { $bad[] = trim($a); $bc++; } } } $this->assertEquals(41, $gc, 'Unexpected good count.'); $this->assertEquals(47, $bc, 'Unexpected bad count.'); echo "Good addresses: $gc\n"; echo "Bad addresses: $bc\n"; // echo join("\n", $bad); // echo "\n"; } } // Running the test. $suite = new PHPUnit_TestSuite('EmailTest'); $result = PHPUnit::run($suite); echo $result->toString(); ?>