Completed
Push — template-events ( d018fc...2e9f01 )
by Kamil
65:59 queued 42:59
created

ContactEmailManagerSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 44
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_implements_a_contact_email_manager_interface() 0 4 1
B it_sends_a_contact_request_email() 0 26 1
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
namespace spec\Sylius\Bundle\ShopBundle\EmailManager;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Bundle\ShopBundle\EmailManager\ContactEmailManager;
16
use Sylius\Bundle\ShopBundle\EmailManager\ContactEmailManagerInterface;
17
use Sylius\Component\Mailer\Sender\SenderInterface;
18
19
/**
20
 * @author Grzegorz Sadowski <[email protected]>
21
 */
22
final class ContactEmailManagerSpec extends ObjectBehavior
23
{
24
    function let(SenderInterface $sender)
25
    {
26
        $this->beConstructedWith($sender);
27
    }
28
29
    function it_is_initializable()
30
    {
31
        $this->shouldHaveType(ContactEmailManager::class);
32
    }
33
34
    function it_implements_a_contact_email_manager_interface()
35
    {
36
        $this->shouldImplement(ContactEmailManagerInterface::class);
37
    }
38
39
    function it_sends_a_contact_request_email(SenderInterface $sender)
40
    {
41
        $sender
42
            ->send(
43
                'contact_request',
44
                ['[email protected]'],
45
                [
46
                    'data' => [
47
                        'email' => '[email protected]',
48
                        'message' => 'Hello!',
49
                    ],
50
                ]
51
            )
52
            ->shouldBeCalled()
53
        ;
54
55
        $this
56
            ->sendContactRequest(
57
                [
58
                    'email' => '[email protected]',
59
                    'message' => 'Hello!',
60
                ],
61
                ['[email protected]']
62
            )
63
        ;
64
    }
65
}
66