Passed
Push — feature/manager_poster_index ( 2dedd6...b4b3c2 )
by Chris
06:27
created

HelperTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 11
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testHumanizeDateDiff() 0 14 1
1
<?php
2
3
namespace Tests\Unit\Helpers;
4
5
use Tests\TestCase;
6
use Illuminate\Foundation\Testing\WithFaker;
7
use Illuminate\Foundation\Testing\RefreshDatabase;
8
use Jenssegers\Date\Date;
9
10
class HelperTest extends TestCase
11
{
12
    /**
13
     * Test that the humanizeDateDiff functions correctly.
14
     *
15
     * @return void
16
     */
17
    public function testHumanizeDateDiff() : void
18
    {
19
        $dateToTest = Date::parse('+5 days');
20
        $diff = humanizeDateDiff($dateToTest);
21
        $this->assertEquals('5 Days', $diff);
22
23
        $dateToTest = Date::parse('-32 minutes');
24
        $diff = humanizeDateDiff($dateToTest);
25
        $this->assertEquals('32 Minutes', $diff);
26
27
        $dateToTest = Date::parse('-10 hours');
28
        $reference = Date::parse('-23 hours');
29
        $diff = humanizeDateDiff($dateToTest, $reference);
30
        $this->assertEquals('13 Hours', $diff);
31
    }
32
}
33