SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 121 | Next

Hasin Hayder

"Object-Oriented Programming with PHP5"

in@somewherein.net");
$this->assertTrue($result);
}
}
Now you have to write the test suit and run:
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTestSuite("TestEmailValidator");
PHPUnit_TextUI_TestRunner::run($suite);
You will get the following output when you run this test suite:
PHPUnit 3.0.5 by Sebastian Bergmann.
...
Time: 00:00
OK (1 test)
Now try harder; try to break your code. Try all the possible cases that may occur in
an email and try as many as you can. We are going to add more test cases:
class TestEmailValidator extends PHPUnit_Framework_TestCase
{
private $Ev;
protected function setUp()
{
$this->Ev = new EmailValidator();
}
protected function tearDown()
{
Reflection and Unit Testing
[ 118 ]
unset($this->Ev);
}
public function testSimpleEmail()
{
$result = $this->Ev->validateEmail("hasin@somewherein.net");
$this->assertTrue($result);
}
public function testEmailWithDotInName()
{
$result = $this->Ev->validateEmail("has.in@somewherein.net");
$this->assertTrue($result);
}
public function testEmailWithComma()
{
$result = $this->Ev->validateEmail("has,in@somewherein.net");
$this->assertFalse($result);
}
public function testEmailWithSpace()
{
$result = $this->Ev->validateEmail("has in@somewherein.


Pages:
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6