Completed
Push — 1.0-stalebot ( 77a076 )
by Kamil
27:19
created

PaymentDescriptionProviderSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
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\PayumBundle\Provider;
15
16
use Doctrine\Common\Collections\ArrayCollection;
17
use PhpSpec\ObjectBehavior;
18
use Sylius\Component\Core\Model\OrderInterface;
19
use Sylius\Component\Core\Model\OrderItem;
20
use Sylius\Component\Core\Model\PaymentInterface;
21
use Symfony\Component\Translation\TranslatorInterface;
22
23
final class PaymentDescriptionProviderSpec extends ObjectBehavior
24
{
25
    function let(TranslatorInterface $translator): void
26
    {
27
        $translator->transChoice('sylius.payum_action.payment.description', 2, [
28
            '%items%' => 2,
29
            '%total%' => 100.00,
30
        ])->willReturn('Payment contains 2 items for a total of 100');
31
32
        $this->beConstructedWith($translator);
33
    }
34
35
    function it_should_generate_a_description_string(PaymentInterface $payment, OrderInterface $order): void
36
    {
37
        $order->getItems()->willReturn(new ArrayCollection([new OrderItem(), new OrderItem()]));
38
        $order->getTotal()->willReturn(10000);
39
        $payment->getOrder()->willReturn($order);
40
41
        $this->getPaymentDescription($payment)->shouldReturn('Payment contains 2 items for a total of 100');
42
    }
43
}
44