1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Sylius package. |
5
|
|
|
* |
6
|
|
|
* (c) Paweł Jędrzejewski |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace spec\Sylius\Component\Mailer\Model; |
15
|
|
|
|
16
|
|
|
use PhpSpec\ObjectBehavior; |
17
|
|
|
use Sylius\Component\Mailer\Model\EmailInterface; |
18
|
|
|
|
19
|
|
|
final class EmailSpec extends ObjectBehavior |
20
|
|
|
{ |
21
|
|
|
function it_implements_email_interface(): void |
22
|
|
|
{ |
23
|
|
|
$this->shouldImplement(EmailInterface::class); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
function it_has_no_code_by_default(): void |
27
|
|
|
{ |
28
|
|
|
$this->getCode()->shouldReturn(null); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
function its_code_is_mutable(): void |
32
|
|
|
{ |
33
|
|
|
$this->setCode('bar'); |
34
|
|
|
$this->getCode()->shouldReturn('bar'); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
function its_subject_is_mutable(): void |
38
|
|
|
{ |
39
|
|
|
$this->setSubject('foo'); |
40
|
|
|
$this->getSubject()->shouldReturn('foo'); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
function its_content_is_mutable(): void |
44
|
|
|
{ |
45
|
|
|
$this->setContent('foo content'); |
46
|
|
|
$this->getContent()->shouldReturn('foo content'); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
function its_template_is_mutable(): void |
50
|
|
|
{ |
51
|
|
|
$this->setContent('template.html.twig'); |
52
|
|
|
$this->getContent()->shouldReturn('template.html.twig'); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
function its_sender_name_is_mutable(): void |
56
|
|
|
{ |
57
|
|
|
$this->setSenderName('Example'); |
58
|
|
|
$this->getSenderName()->shouldReturn('Example'); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
function its_sender_address_is_mutable(): void |
62
|
|
|
{ |
63
|
|
|
$this->setSenderAddress('[email protected]'); |
64
|
|
|
$this->getSenderAddress()->shouldReturn('[email protected]'); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
function it_is_enabled_by_default(): void |
68
|
|
|
{ |
69
|
|
|
$this->shouldBeEnabled(); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
function it_can_be_disabled(): void |
73
|
|
|
{ |
74
|
|
|
$this->setEnabled(false); |
75
|
|
|
$this->shouldNotBeEnabled(); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|