testConstructorNegativeScaleValidation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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