Completed
Push — master ( cfaf77...b5ed7c )
by Kamil
47:11 queued 29:42
created

FormatMoneyHelperSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 29
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_is_a_templating_helper() 0 4 1
A it_implements_format_money_helper_interface() 0 4 1
A it_formats_money_using_given_currency_and_locale() 0 6 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\MoneyBundle\Templating\Helper;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Bundle\MoneyBundle\Formatter\MoneyFormatterInterface;
16
use Sylius\Bundle\MoneyBundle\Templating\Helper\FormatMoneyHelper;
17
use Sylius\Bundle\MoneyBundle\Templating\Helper\FormatMoneyHelperInterface;
18
use Symfony\Component\Templating\Helper\Helper;
19
20
/**
21
 * @author Paweł Jędrzejewski <[email protected]>
22
 * @author Łukasz Chruściel <[email protected]>
23
 */
24
final class FormatMoneyHelperSpec extends ObjectBehavior
25
{
26
    function let(MoneyFormatterInterface $moneyFormatter)
27
    {
28
        $this->beConstructedWith($moneyFormatter);
29
    }
30
31
    function it_is_initializable()
32
    {
33
        $this->shouldHaveType(FormatMoneyHelper::class);
34
    }
35
36
    function it_is_a_templating_helper()
37
    {
38
        $this->shouldHaveType(Helper::class);
39
    }
40
41
    function it_implements_format_money_helper_interface()
42
    {
43
        $this->shouldImplement(FormatMoneyHelperInterface::class);
44
    }
45
46
    function it_formats_money_using_given_currency_and_locale(MoneyFormatterInterface $moneyFormatter)
47
    {
48
        $moneyFormatter->format(2500, 'EUR', 'fr_FR')->willReturn('€25.00');
49
50
        $this->formatAmount(2500, 'EUR', 'fr_FR')->shouldReturn('€25.00');
51
    }
52
}
53