Failed Conditions
Push — preview-1.19.0 ( 7438ce...cca8d0 )
by Guilherme
12:04
created

AccessTokenTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testEntity() 0 17 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\OAuthBundle\Tests\Entity;
12
13
use LoginCidadao\OAuthBundle\Entity\AccessToken;
14
15
class AccessTokenTest extends \PHPUnit_Framework_TestCase
16
{
17
    /**
18
     * @group time-sensitive
19
     */
20
    public function testEntity()
21
    {
22
        $idToken = 'id_token';
23
24
        $accessToken = new AccessToken();
25
        $accessToken
26
            ->setIdToken($idToken)
27
            ->setCreatedAtValue();
28
29
        $this->assertFalse($accessToken->hasExpired());
30
31
        $accessToken->setExpired();
32
        sleep(2);
33
34
        $this->assertEquals($idToken, $accessToken->getIdToken());
35
        $this->assertTrue($accessToken->hasExpired());
36
        $this->assertInstanceOf('\DateTime', $accessToken->getCreatedAt());
37
    }
38
}
39