Passed
Push — issue#767 ( b3675b...a787f5 )
by Guilherme
05:11
created

AccessSessionTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testAccessSession() 0 21 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\CoreBundle\Tests\Entity;
12
13
use LoginCidadao\CoreBundle\Entity\AccessSession;
14
15
class AccessSessionTest extends \PHPUnit_Framework_TestCase
16
{
17
    public function testAccessSession()
18
    {
19
        $iDhacess = new \DateTime();
20
        $ip = '::1';
21
        $username = 'myusername';
22
        $val = 123;
23
24
        $accessSession = new AccessSession();
25
        $accessSession->setIDhacess($iDhacess);
26
        $accessSession->setIp($ip);
27
        $accessSession->setUsername($username);
28
        $accessSession->setVal($val);
29
30
        $this->assertSame($iDhacess, $accessSession->getIDhacess());
31
        $this->assertSame($ip, $accessSession->getIp());
32
        $this->assertSame($username, $accessSession->getUsername());
33
        $this->assertSame($val, $accessSession->getVal());
34
        $this->assertNull($accessSession->getId());
35
36
        $accessSession->doStuffOnPrePersist();
37
        $this->assertNotSame($iDhacess, $accessSession->getIDhacess());
38
    }
39
}
40