Completed
Pull Request — master (#51)
by
unknown
08:53
created

testConstructorNegativeScaleValidation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
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
5
6
date_default_timezone_set('UTC');
7
8
9
class DecimalInternalValidationTest extends PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @expectedException \InvalidArgumentException
13
     * @expectedExceptionMessage $value must be a non null number
14
     */
15
    public function testConstructorNullValueValidation()
16
    {
17
        Decimal::fromInteger(null);
18
    }
19
20
    /**
21
     * @expectedException \InvalidArgumentException
22
     * @expectedExceptionMessage $scale must be a positive integer
23
     */
24
    public function testConstructorNegativeScaleValidation()
25
    {
26
        Decimal::fromString("25", -15);
27
    }
28
29
    /**
30
     * @expectedException \InvalidArgumentException
31
     * @expectedExceptionMessage $scale must be a positive integer
32
     */
33
    public function testConstructorNotIntegerScaleValidation()
34
    {
35
        Decimal::fromString("25", "hola mundo");
36
    }
37
38
    /**
39
     * @expectedException \InvalidArgumentException
40
     * @expectedExceptionMessage $scale must be a positive integer
41
     */
42
    public function testOperatorNegativeScaleValidation()
43
    {
44
        $one = Decimal::fromInteger(1);
45
46
        $one->mul($one, -1);
47
    }
48
}
49