|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the BenGorUser package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Beñat Espiña <[email protected]> |
|
7
|
|
|
* (c) Gorka Laucirica <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
10
|
|
|
* file that was distributed with this source code. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace spec\BenGorUser\TwigBridge\Infrastructure\Mailing; |
|
14
|
|
|
|
|
15
|
|
|
use BenGorUser\TwigBridge\Infrastructure\Mailing\TwigUserMailableFactory; |
|
16
|
|
|
use BenGorUser\User\Domain\Model\UserEmail; |
|
17
|
|
|
use BenGorUser\User\Domain\Model\UserMailable; |
|
18
|
|
|
use BenGorUser\User\Domain\Model\UserMailableFactory; |
|
19
|
|
|
use PhpSpec\ObjectBehavior; |
|
20
|
|
|
use Symfony\Bridge\Twig\Extension\TranslationExtension; |
|
21
|
|
|
use Symfony\Component\Translation\Translator; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Spec file of TwigUserMailableFactory class. |
|
25
|
|
|
* |
|
26
|
|
|
* @author Beñat Espiña <[email protected]> |
|
27
|
|
|
*/ |
|
28
|
|
|
class TwigUserMailableFactorySpec extends ObjectBehavior |
|
29
|
|
|
{ |
|
30
|
|
|
function let() |
|
31
|
|
|
{ |
|
32
|
|
|
$loader = new \Twig_Loader_Filesystem( |
|
33
|
|
|
__DIR__ . '/../../../../../src/BenGorUser/TwigBridge/Infrastructure/Ui/Twig/views' |
|
34
|
|
|
); |
|
35
|
|
|
$twig = new \Twig_Environment($loader); |
|
36
|
|
|
$twig->addExtension(new TranslationExtension( |
|
37
|
|
|
new Translator('en_US') |
|
38
|
|
|
)); |
|
39
|
|
|
|
|
40
|
|
|
$this->beConstructedWith($twig, 'Email/sign_up.html.twig', '[email protected]'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
function it_is_initializable() |
|
44
|
|
|
{ |
|
45
|
|
|
$this->shouldHaveType(TwigUserMailableFactory::class); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
function it_implements_user_mailable_factory() |
|
49
|
|
|
{ |
|
50
|
|
|
$this->shouldImplement(UserMailableFactory::class); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
function it_builds() |
|
54
|
|
|
{ |
|
55
|
|
|
$to = new UserEmail('[email protected]'); |
|
56
|
|
|
|
|
57
|
|
|
$this->build($to, [])->shouldReturnAnInstanceOf(UserMailable::class); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
function it_builds_with_multiples_receivers() |
|
61
|
|
|
{ |
|
62
|
|
|
$to = [ |
|
63
|
|
|
new UserEmail('[email protected]'), |
|
64
|
|
|
new UserEmail('[email protected]'), |
|
65
|
|
|
new UserEmail('[email protected]'), |
|
66
|
|
|
]; |
|
67
|
|
|
|
|
68
|
|
|
$this->build($to, [])->shouldReturnAnInstanceOf(UserMailable::class); |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|