CurrencyTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 3
dl 0
loc 45
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A testCurrency() 0 4 1
A testExceptionWhenEmptyName() 0 5 1
A testExceptionWhenInvalidCode() 0 5 1
A testExceptionWhenEmptyCountryName() 0 5 1
A testExceptionWhenInvalidCountryName() 0 5 1
A testExceptionWhenNegativeDigits() 0 5 1
A testExceptionWhenEmptyNumber() 0 5 1
1
<?php
2
declare(strict_types=1);
3
namespace Thunder\Currenz\Tests;
4
5
use PHPUnit\Framework\TestCase;
6
use Thunder\Currenz\Currency;
7
8
final class CurrencyTest extends TestCase
9
{
10
    use TestTrait;
11
12
    public function testCurrency()
13
    {
14
        $this->assertCurrency(new Currency('NAME', 'COD', 2, ['RANDOM'], '128'), 'COD', 'NAME', ['RANDOM'], 2, '128');
15
    }
16
17
    public function testExceptionWhenEmptyName()
18
    {
19
        $this->expectException(\InvalidArgumentException::class);
20
        new Currency('', 'COD', 2, ['RANDOM'], '128');
21
    }
22
23
    public function testExceptionWhenInvalidCode()
24
    {
25
        $this->expectException(\InvalidArgumentException::class);
26
        new Currency('NAME', 'CODE', 2, ['RANDOM'], '128');
27
    }
28
29
    public function testExceptionWhenEmptyCountryName()
30
    {
31
        $this->expectException(\InvalidArgumentException::class);
32
        new Currency('NAME', 'COD', 2, [''], '128');
33
    }
34
35
    public function testExceptionWhenInvalidCountryName()
36
    {
37
        $this->expectException(\InvalidArgumentException::class);
38
        new Currency('NAME', 'COD', 2, [null], '128');
39
    }
40
41
    public function testExceptionWhenNegativeDigits()
42
    {
43
        $this->expectException(\InvalidArgumentException::class);
44
        new Currency('NAME', 'COD', -1, ['RANDOM'], '128');
45
    }
46
47
    public function testExceptionWhenEmptyNumber()
48
    {
49
        $this->expectException(\InvalidArgumentException::class);
50
        new Currency('NAME', 'COD', 2, ['RANDOM'], 'A00');
51
    }
52
}
53