Failed Conditions
Push — master ( 9bceb4...42a7b7 )
by Guilherme
02:51 queued 10s
created

StatisticsTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 1
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LoginCidadao\StatsBundle\Tests\Entity;
12
13
use LoginCidadao\StatsBundle\Entity\Statistics;
14
use PHPUnit\Framework\TestCase;
15
16
class StatisticsTest extends TestCase
17
{
18
    public function testStatistics()
19
    {
20
        $date = '2018-01-01';
21
        $time = '01:02:03';
22
        $index = 'index';
23
        $key = 'key';
24
        /** @var \DateTime $timestamp */
25
        $timestamp = \DateTime::createFromFormat('Y-m-d H:i:s', "{$date} {$time}");
26
        $value = 321;
27
28
        $statistics = (new Statistics())
29
            ->setIndex($index)
30
            ->setKey($key)
31
            ->setTimestamp($timestamp)
32
            ->setValue($value);
33
34
        $this->assertNull($statistics->getId());
35
        $this->assertSame($index, $statistics->getIndex());
36
        $this->assertSame($key, $statistics->getKey());
37
        $this->assertSame($timestamp, $statistics->getTimestamp());
38
        $this->assertSame($value, $statistics->getValue());
39
        $this->assertSame($date, $statistics->getDate());
40
        $this->assertSame("{$date} {$time}", $statistics->getDateTime());
41
    }
42
}
43