Completed
Push — pull-request/9162 ( e6f9a5 )
by Kamil
130:56 queued 94:26
created

CurrencyNameConverterSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
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
declare(strict_types=1);
13
14
namespace spec\Sylius\Component\Currency\Converter;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Component\Currency\Converter\CurrencyNameConverterInterface;
18
19
final class CurrencyNameConverterSpec extends ObjectBehavior
20
{
21
    function it_implements_a_currency_name_converter_interface(): void
22
    {
23
        $this->shouldImplement(CurrencyNameConverterInterface::class);
24
    }
25
26
    function it_converts_an_english_currency_name_to_code_by_default(): void
27
    {
28
        $this->convertToCode('Euro')->shouldReturn('EUR');
29
    }
30
31
    function it_converts_a_name_to_a_code_for_given_locale(): void
32
    {
33
        $this->convertToCode('rupia indyjska', 'pl')->shouldReturn('INR');
34
    }
35
36
    function it_throws_an_invalid_argument_exception_when_currency_not_exists(): void
37
    {
38
        $this->shouldThrow(\InvalidArgumentException::class)->during('convertToCode', ['Meuro']);
39
    }
40
}
41