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

PaymentDescriptionProviderSpec   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 6
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 9 1
A it_should_generate_a_description_string() 0 8 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