Test Setup Failed
Push — master ( 13928a...35a0ba )
by Petr
03:24
created

FactorialTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A factorialize_numberToFactorialize_factorizationResult() 0 8 1
A provideFactorialsWithResults() 0 12 1
1
<?php
2
3
namespace Tests;
4
5
use Vehsamrak\Factorial\Factorial;
6
7
class FactorialTest extends \PHPUnit_Framework_TestCase
8
{
9
10
    /**
11
     * @test
12
     * @dataProvider provideFactorialsWithResults
13
     */
14
    public function factorialize_numberToFactorialize_factorizationResult(int $numberToFactorialize, int $result): void
15
    {
16
        $factorial = new Factorial();
17
18
        $factorialResult = $factorial->factorialize($numberToFactorialize);
19
20
        $this->assertEquals($result, $factorialResult);
21
    }
22
23
    public function provideFactorialsWithResults(): array
24
    {
25
        return [
26
            [0, 1],
27
            [1, 1],
28
            [2, 2],
29
            [3, 6],
30
            [4, 24],
31
            [5, 120],
32
            [6, 720],
33
        ];
34
    }
35
}
36