Completed
Push — master ( a818cb...b1c6ca )
by Kamil
07:13 queued 10s
created

OrderEmailManagerSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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
declare(strict_types=1);
13
14
namespace spec\Sylius\Bundle\AdminBundle\EmailManager;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Bundle\AdminBundle\EmailManager\OrderEmailManagerInterface;
18
use Sylius\Component\Core\Model\ChannelInterface;
19
use Sylius\Component\Core\Model\CustomerInterface;
20
use Sylius\Component\Core\Model\OrderInterface;
21
use Sylius\Component\Mailer\Sender\SenderInterface;
22
23
final class OrderEmailManagerSpec extends ObjectBehavior
24
{
25
    function let(SenderInterface $sender): void
26
    {
27
        $this->beConstructedWith($sender);
28
    }
29
30
    function it_implements_an_order_email_manager_interface(): void
31
    {
32
        $this->shouldImplement(OrderEmailManagerInterface::class);
33
    }
34
35
    function it_sends_an_order_confirmation_email(
36
        SenderInterface $sender,
37
        OrderInterface $order,
38
        ChannelInterface $channel,
39
        CustomerInterface $customer
40
    ): void {
41
        $order->getChannel()->willReturn($channel);
42
        $order->getLocaleCode()->willReturn('en_US');
43
        $order->getCustomer()->willReturn($customer);
44
        $customer->getEmail()->willReturn('[email protected]');
45
46
        $sender
47
            ->send('order_confirmation_resent', ['[email protected]'], [
48
                'order' => $order,
49
                'channel' => $channel,
50
                'localeCode' => 'en_US',
51
            ])
52
            ->shouldBeCalled()
53
        ;
54
55
        $this->sendConfirmationEmail($order);
56
    }
57
}
58