Completed
Push — reproduce-taxon-autocompletion ( 8c649e )
by Kamil
22:05
created

CurrencyNameConverterSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_implements_a_currency_name_converter_interface() 0 4 1
A it_converts_an_english_currency_name_to_code_by_default() 0 4 1
A it_converts_a_name_to_a_code_for_given_locale() 0 4 1
A it_throws_an_invalid_argument_exception_when_currency_not_exists() 0 4 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\Component\Currency\Converter;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Component\Currency\Converter\CurrencyNameConverter;
16
use Sylius\Component\Currency\Converter\CurrencyNameConverterInterface;
17
18
/**
19
 * @author Anna Walasek <[email protected]>
20
 */
21
final class CurrencyNameConverterSpec extends ObjectBehavior
22
{
23
    function it_is_initializable()
24
    {
25
        $this->shouldHaveType(CurrencyNameConverter::class);
26
    }
27
28
    function it_implements_a_currency_name_converter_interface()
29
    {
30
        $this->shouldImplement(CurrencyNameConverterInterface::class);
31
    }
32
33
    function it_converts_an_english_currency_name_to_code_by_default()
34
    {
35
        $this->convertToCode('Euro')->shouldReturn('EUR');
36
    }
37
38
    function it_converts_a_name_to_a_code_for_given_locale()
39
    {
40
        $this->convertToCode('rupia indyjska', 'pl')->shouldReturn('INR');
41
    }
42
43
    function it_throws_an_invalid_argument_exception_when_currency_not_exists()
44
    {
45
        $this->shouldThrow(\InvalidArgumentException::class)->during('convertToCode', ['Meuro']);
46
    }
47
}
48