Failed Conditions
Push — preview_pr236 ( 69ee07...f370cd )
by Guilherme
13:30
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 Method

Rating   Name   Duplication   Size   Complexity  
A testStatistics() 0 23 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
15
class StatisticsTest extends \PHPUnit_Framework_TestCase
16
{
17
    public function testStatistics()
18
    {
19
        $date = '2018-01-01';
20
        $time = '01:02:03';
21
        $index = 'index';
22
        $key = 'key';
23
        /** @var \DateTime $timestamp */
24
        $timestamp = \DateTime::createFromFormat('Y-m-d H:i:s', "{$date} {$time}");
25
        $value = 321;
26
27
        $statistics = (new Statistics())
28
            ->setIndex($index)
29
            ->setKey($key)
30
            ->setTimestamp($timestamp)
31
            ->setValue($value);
32
33
        $this->assertNull($statistics->getId());
34
        $this->assertSame($index, $statistics->getIndex());
35
        $this->assertSame($key, $statistics->getKey());
36
        $this->assertSame($timestamp, $statistics->getTimestamp());
37
        $this->assertSame($value, $statistics->getValue());
38
        $this->assertSame($date, $statistics->getDate());
39
        $this->assertSame("{$date} {$time}", $statistics->getDateTime());
40
    }
41
}
42