TimeTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAnsiSqlTimestampBasic() 0 4 1
A inMillis() 0 8 1
1
<?php
2
3
namespace TraderInteractive\Util;
4
5
use TraderInteractive\Util\Time as TimeUtil;
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * @coversDefaultClass \TraderInteractive\Util\Time
10
 */
11
final class TimeTest extends TestCase
12
{
13
    /**
14
     * @test
15
     * @covers ::getAnsiSqlTimestamp
16
     */
17
    public function getAnsiSqlTimestampBasic()
18
    {
19
        date_default_timezone_set('America/New_York');
20
        $this->assertSame("(TIMESTAMP'2013-05-02 10:57:08')", TimeUtil::getAnsiSqlTimestamp(1367506628));
21
    }
22
23
    /**
24
     * @test
25
     * @covers ::inMillis
26
     */
27
    public function inMillis()
28
    {
29
        $beforeSeconds = time();
30
        $milliseconds = TimeUtil::inMillis();
31
        $afterSecondsPlus = time() + 1;
32
33
        $this->assertGreaterThanOrEqual($beforeSeconds * 1000, $milliseconds);
34
        $this->assertLessThanOrEqual($afterSecondsPlus * 1000, $milliseconds);
35
    }
36
}
37