Completed
Push — master ( 58620c...f23d9f )
by Vitaliy
02:20
created

shouldThrowExceptionInGetValueIfExpirationIsNull()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the AppleApnPush package
5
 *
6
 * (c) Vitaliy Zhuk <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code
10
 */
11
12
namespace Tests\Apple\ApnPush\Model;
13
14
use Apple\ApnPush\Model\Expiration;
15
use PHPUnit\Framework\TestCase;
16
17
class ExpirationTest extends TestCase
18
{
19
    /**
20
     * @test
21
     *
22
     * @expectedException \LogicException
23
     * @expectedExceptionMessage Can not get value of expiration from null value.
24
     */
25
    public function shouldThrowExceptionInGetValueIfExpirationIsNull()
26
    {
27
        $expiration = Expiration::fromNull();
28
        $expiration->getValue();
29
    }
30
31
    /**
32
     * @test
33
     */
34
    public function shouldReturnZeroIfNotStore()
35
    {
36
        $expiration = Expiration::notStore();
37
        $value = $expiration->getValue();
38
39
        self::assertEquals(0, $value);
40
    }
41
42
    /**
43
     * @test
44
     */
45
    public function shouldSuccessGetValue()
46
    {
47
        $now = new \DateTime();
48
        $expiration = Expiration::storeTo($now);
49
50
        $value = $expiration->getValue();
51
52
        self::assertEquals($now->format('U'), $value);
53
    }
54
}
55