MinutesTest   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 58
rs 10
wmc 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A inYearsCalculatesValue() 0 5 2
A inHoursCalculatesValue() 0 4 2
A inDaysCalculatesValue() 0 5 2
A inWeeksCalculatesValue() 0 5 2
A inMonthsCalculatesValue() 0 5 2
1
<?php
2
3
namespace SubjectivePHPTest\Durations;
4
5
use SubjectivePHP\Durations\Minutes;
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * @coversDefaultClass \SubjectivePHP\Durations\Minutes
10
 */
11
final class MinutesTest extends TestCase
12
{
13
    /**
14
     * @test
15
     * @covers ::inHours
16
     */
17
    public function inHoursCalculatesValue()
18
    {
19
        for ($i = 0; $i < 60; $i++) {
20
            $this->assertSame(60 * $i, Minutes::inHours($i));
21
        }
22
    }
23
24
    /**
25
     * @test
26
     * @covers ::inDays
27
     */
28
    public function inDaysCalculatesValue()
29
    {
30
        for ($i = 0; $i < 60; $i++) {
31
            $expected = 60 * 24 * $i;
32
            $this->assertSame($expected, Minutes::inDays($i));
33
        }
34
    }
35
36
    /**
37
     * @test
38
     * @covers ::inWeeks
39
     */
40
    public function inWeeksCalculatesValue()
41
    {
42
        for ($i = 0; $i < 60; $i++) {
43
            $expected = 60 * 24 * 7 * $i;
44
            $this->assertSame($expected, Minutes::inWeeks($i));
45
        }
46
    }
47
48
    /**
49
     * @test
50
     * @covers ::inMonths
51
     */
52
    public function inMonthsCalculatesValue()
53
    {
54
        for ($i = 0; $i < 60; $i++) {
55
            $expected = 60 * 24 * 30 * $i;
56
            $this->assertSame($expected, Minutes::inMonths($i));
57
        }
58
    }
59
60
    /**
61
     * @test
62
     * @covers ::inYears
63
     */
64
    public function inYearsCalculatesValue()
65
    {
66
        for ($i = 0; $i < 60; $i++) {
67
            $expected = 60 * 24 * 365 * $i;
68
            $this->assertSame($expected, Minutes::inYears($i));
69
        }
70
    }
71
}
72