Completed
Pull Request — master (#75)
by
unknown
01:40
created

DecimalJsonSerialize   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 14
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testJsonSerialize() 0 5 1
A testJsonSerializable() 0 5 1
1
<?php
2
3
use Litipk\BigNumbers\Decimal as Decimal;
4
use PHPUnit\Framework\TestCase;
5
6
class DecimalJsonSerialize extends TestCase
7
{
8
    public function testJsonSerialize()
9
    {
10
        $value = '123.456';
11
        $this->assertEquals($value, Decimal::fromString($value)->jsonSerialize());
12
    }
13
14
    public function testJsonSerializable()
15
    {
16
        $value = '123.456';
17
        $this->assertEquals(json_encode($value), json_encode(Decimal::fromString($value)));
18
    }
19
}
20