-
Notifications
You must be signed in to change notification settings - Fork 455
Expand file tree
/
Copy pathEmailTest.php
More file actions
57 lines (40 loc) · 1.53 KB
/
EmailTest.php
File metadata and controls
57 lines (40 loc) · 1.53 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
use PHPUnit\Framework\TestCase;
use SimpleSoftwareIO\QrCode\DataTypes\Email;
class EmailTest extends TestCase
{
private Email $email;
public function setUp(): void
{
$this->email = new Email();
}
public function test_it_generates_the_proper_format_when_only_an_email_address_is_supplied()
{
$this->email->create(['foo@bar.com']);
$properFormat = 'mailto:foo@bar.com';
$this->assertEquals($properFormat, strval($this->email));
}
public function test_it_generates_the_proper_format_when_an_email_subject_and_body_are_supplied()
{
$this->email->create(['foo@bar.com', 'foo', 'bar']);
$properFormat = 'mailto:foo@bar.com?subject=foo&body=bar';
$this->assertEquals($properFormat, strval($this->email));
}
public function test_it_generates_the_proper_format_when_an_email_and_subject_are_supplied()
{
$this->email->create(['foo@bar.com', 'foo']);
$properFormat = 'mailto:foo@bar.com?subject=foo';
$this->assertEquals($properFormat, strval($this->email));
}
public function test_it_generates_the_proper_format_when_only_a_subject_is_provided()
{
$this->email->create([null, 'foo']);
$properFormat = 'mailto:?subject=foo';
$this->assertEquals($properFormat, strval($this->email));
}
public function test_it_throws_an_exception_when_an_invalid_email_is_given()
{
$this->expectException(InvalidArgumentException::class);
$this->email->create(['foo']);
}
}