Passed
Push — master ( 62401f...daf94f )
by Alec
07:24
created

CurrencyTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 5
1
<?php
2
/**
3
 * User: alec
4
 * Date: 05.11.18
5
 * Time: 20:35
6
 */
7
8
namespace Unit\Money;
9
10
use AlecRabbit\Money\Currency;
11
use PHPUnit\Framework\TestCase;
12
13
class CurrencyTest extends TestCase
14
{
15
    /** @test */
16
    public function string(): void
17
    {
18
        $c = new Currency('usd');
19
        $this->assertEquals('USD', (string)$c);
20
    }
21
22
    /** @test */
23
    public function getCode(): void
24
    {
25
        $c = new Currency('usd');
26
        $this->assertEquals('USD', $c->getCode());
27
    }
28
29
    /** @test */
30
    public function jsonConversion(): void
31
    {
32
        $this->assertEquals('"USD"', json_encode(new Currency('USD')));
33
    }
34
35
    /** @test */
36
    public function equals(): void
37
    {
38
        $c = new Currency('usd');
39
        $o = new Currency('usd');
40
        $this->assertTrue($c->equals($o));
41
    }
42
43
    /** @test */
44
    public function construct(): void
45
    {
46
        $this->assertInstanceOf(Currency::class, new Currency('usd'));
47
    }
48
}
49