net");
$this->assertTrue($result);
}
public function testEmailLengthMoreThan64Char()
{
$result =
$this->Ev->validateEmail(str_repeat("h",67)."@somewherein.net");
$this->assertFalse($result);
}
public function testEmailWithInValidCharacters()
{
$result = $this->Ev->validateEmail("has#in@somewherein.net");
$this->assertFalse($result);
}
public function testEmailWithNoDomain()
{
$result = $this->Ev->validateEmail("hasin@");
$this->assertFalse($result);
}
public function testEmailWithInvalidDomain()
{
$result =
$this->Ev->validateEmail("hasin@somewherein.comnetorg");
$this->assertFalse($result);
}
}
Chapter 5
[ 119 ]
When you run the test suite, you will get the following result:
PHPUnit 3.0.5 by Sebastian Bergmann.
.F.F....
Time: 00:00
There were 1 failures:
1) testEmailWithDotInName(TestEmailValidator)
Failed asserting that
is identical to .
C:\OOP with PHP5\Codes\ch5\UnitTest\EmailValidatorTest.php:40
C:\OOP with PHP5\Codes\ch5\UnitTest\EmailValidatorTest.php:83
C:\Program Files\Zend\ZendStudio-5.2.0\bin\php5\dummy.php:1
FAILURES!
Tests: 8, Failures: 1.
So our email validator fails! If you look at the result you will see that it fails with
testEmailWithDotInName.
Pages:
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134