-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise6Test.php
29 lines (24 loc) · 983 Bytes
/
Exercise6Test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
namespace Chapter08\Exercise6;
use PHPUnit\Framework\TestCase;
class Exercise6Test extends TestCase
{
public function test_no_argument_throws_exception()
{
$expected = 'Caught [InvalidArgumentException]: No value to check.';
$actual = exec('php -f app/Chapter08/Exercise6/validate-email.php');
$this->assertStringContainsString($expected, $actual);
}
public function test_invalid_email_throws_validation_message()
{
$expected = 'Caught [InvalidEmail]: The email validation has failed.';
$actual = exec('php -f app/Chapter08/Exercise6/validate-email.php john@');
$this->assertStringContainsString($expected, $actual);
}
public function test_valid_email_shows_valid_message()
{
$expected = 'The input value is valid email.';
$actual = exec('php -f app/Chapter08/Exercise6/validate-email.php [email protected]');
$this->assertStringContainsString($expected, $actual);
}
}