GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

BigIntegerDivideTest   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 129
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 9
c 4
b 0
f 1
lcom 1
cbo 2
dl 0
loc 129
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A testWithInteger() 0 12 1
A testWithString() 0 12 1
A testWithBigInteger() 0 13 1
A testWithNegativeNumbber() 0 13 1
A testWithTwoNegativeNumbber() 0 13 1
A testWithHalfNumbbers() 0 13 1
A testWithInvalidValue() 0 11 1
A testWithMutableFalse() 0 14 1
A testWithMutableTrue() 0 14 1
1
<?php
2
3
namespace PHP\Math\BigIntegerTest;
4
5
use PHP\Math\BigInteger\BigInteger;
6
use PHPUnit_Framework_TestCase;
7
8
class BigIntegerDivideTest extends PHPUnit_Framework_TestCase
9
{
10
    public function testWithInteger()
11
    {
12
        // Arrange
13
        $bigInteger = new BigInteger('123');
14
15
        // Act
16
        $bigInteger->divide(123);
17
18
        // Assert
19
        $this->assertInternalType('string', $bigInteger->getValue());
20
        $this->assertEquals('1', $bigInteger->getValue());
21
    }
22
23
    public function testWithString()
24
    {
25
        // Arrange
26
        $bigInteger = new BigInteger('123');
27
28
        // Act
29
        $bigInteger->divide('123');
30
31
        // Assert
32
        $this->assertInternalType('string', $bigInteger->getValue());
33
        $this->assertEquals('1', $bigInteger->getValue());
34
    }
35
36
    public function testWithBigInteger()
37
    {
38
        // Arrange
39
        $bigInteger = new BigInteger('123');
40
        $bigIntegerValue = new BigInteger('123');
41
42
        // Act
43
        $bigInteger->divide($bigIntegerValue);
44
45
        // Assert
46
        $this->assertInternalType('string', $bigInteger->getValue());
47
        $this->assertEquals('1', $bigInteger->getValue());
48
    }
49
50
    public function testWithNegativeNumbber()
51
    {
52
        // Arrange
53
        $bigInteger = new BigInteger('123');
54
        $bigIntegerValue = new BigInteger('-123');
55
56
        // Act
57
        $bigInteger->divide($bigIntegerValue);
58
59
        // Assert
60
        $this->assertInternalType('string', $bigInteger->getValue());
61
        $this->assertEquals('-1', $bigInteger->getValue());
62
    }
63
64
    public function testWithTwoNegativeNumbber()
65
    {
66
        // Arrange
67
        $bigInteger = new BigInteger('-123');
68
        $bigIntegerValue = new BigInteger('-123');
69
70
        // Act
71
        $bigInteger->divide($bigIntegerValue);
72
73
        // Assert
74
        $this->assertInternalType('string', $bigInteger->getValue());
75
        $this->assertEquals('1', $bigInteger->getValue());
76
    }
77
78
    public function testWithHalfNumbbers()
79
    {
80
        // Arrange
81
        $bigInteger = new BigInteger('3');
82
        $bigIntegerValue = new BigInteger('2');
83
84
        // Act
85
        $bigInteger->divide($bigIntegerValue);
86
87
        // Assert
88
        $this->assertInternalType('string', $bigInteger->getValue());
89
        $this->assertEquals('1', $bigInteger->getValue());
90
    }
91
92
    /**
93
     * @expectedException InvalidArgumentException
94
     */
95
    public function testWithInvalidValue()
96
    {
97
        // Arrange
98
        $bigInteger = new BigInteger('123');
99
100
        // Act
101
        $bigInteger->divide('123.123');
102
103
        // Assert
104
        // ...
105
    }
106
107
    public function testWithMutableFalse()
108
    {
109
        // Arrange
110
        $bigInteger = new BigInteger('5', false);
111
112
        // Act
113
        $newBigInteger = $bigInteger->divide('5');
114
115
        // Assert
116
        $this->assertInstanceOf('PHP\Math\BigInteger\BigInteger', $bigInteger);
117
        $this->assertInstanceOf('PHP\Math\BigInteger\BigInteger', $newBigInteger);
118
        $this->assertEquals('5', $bigInteger->getValue());
119
        $this->assertEquals('1', $newBigInteger->getValue());
120
    }
121
122
    public function testWithMutableTrue()
123
    {
124
        // Arrange
125
        $bigInteger = new BigInteger('5', true);
126
127
        // Act
128
        $newBigInteger = $bigInteger->divide('5');
129
130
        // Assert
131
        $this->assertInstanceOf('PHP\Math\BigInteger\BigInteger', $bigInteger);
132
        $this->assertInstanceOf('PHP\Math\BigInteger\BigInteger', $newBigInteger);
133
        $this->assertEquals('1', $bigInteger->getValue());
134
        $this->assertEquals('1', $newBigInteger->getValue());
135
    }
136
}
137