Completed
Push — master ( 4be4b5...14df4a )
by Guillaume
07:45 queued 07:45
created

testTokenShouldNotBeValidIfExpirationIsNow()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Eljam\GuzzleJwt\Tests;
4
5
use Eljam\GuzzleJwt\JwtToken;
6
7
class JwtTokenTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testTokenShouldNotBeValidIfExpirationIsInThePast()
10
    {
11
        $token = new JwtToken('foo', new \DateTime('now - 5 minutes'));
12
13
        $this->assertFalse($token->isValid());
14
    }
15
16
    public function testTokenShouldNotBeValidIfExpirationIsNow()
17
    {
18
        $token = new JwtToken('foo', new \DateTime('now'));
19
20
        $this->assertFalse($token->isValid());
21
    }
22
23
    public function testTokenShouldBeValidIfExpirationIsInTheFuture()
24
    {
25
        $token = new JwtToken('foo', new \DateTime('now + 5 minutes'));
26
27
        $this->assertTrue($token->isValid());
28
    }
29
}
30