DecimalInternalValidationTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 30
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructorNullValueValidation() 0 4 1
A testConstructorNegativeScaleValidation() 0 4 1
A testOperatorNegativeScaleValidation() 0 6 1
1
<?php
2
3
use Litipk\BigNumbers\Decimal as Decimal;
4
use PHPUnit\Framework\TestCase;
5
6
date_default_timezone_set('UTC');
7
8
class DecimalInternalValidationTest extends TestCase
9
{
10
    /**
11
     * @expectedException \TypeError
12
     */
13
    public function testConstructorNullValueValidation()
14
    {
15
        Decimal::fromInteger(null);
16
    }
17
18
    /**
19
     * @expectedException \InvalidArgumentException
20
     * @expectedExceptionMessage $scale must be a positive integer
21
     */
22
    public function testConstructorNegativeScaleValidation()
23
    {
24
        Decimal::fromString("25", -15);
25
    }
26
27
    /**
28
     * @expectedException \InvalidArgumentException
29
     * @expectedExceptionMessage $scale must be a positive integer
30
     */
31
    public function testOperatorNegativeScaleValidation()
32
    {
33
        $one = Decimal::fromInteger(1);
34
35
        $one->mul($one, -1);
36
    }
37
}
38