Completed
Push — master ( b2c31d...142309 )
by Vitaliy
01:49
created

ApnIdTest::shouldSuccessCreateFromId()   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
/*
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\ApnId;
15
use PHPUnit\Framework\TestCase;
16
17
class ApnIdTest extends TestCase
18
{
19
    /**
20
     * @test
21
     *
22
     * @expectedException \InvalidArgumentException
23
     * @expectedExceptionMessage Invalid UUID identifier "asd".
24
     */
25
    public function shouldThrowsExceptionIfIdIsInvalid()
26
    {
27
        ApnId::fromId('asd');
28
    }
29
30
    /**
31
     * @test
32
     */
33
    public function shouldSuccessCreateFromId()
34
    {
35
        $id = ApnId::fromId('6c109fec-9123-11e6-ae22-56b6b6499611');
36
37
        self::assertEquals('6c109fec-9123-11e6-ae22-56b6b6499611', $id->getValue());
38
    }
39
40
    /**
41
     * @test
42
     */
43
    public function shouldSuccessCreateNullId()
44
    {
45
        $id = ApnId::fromNull();
46
47
        self::assertTrue($id->isNull());
48
    }
49
50
    /**
51
     * @test
52
     *
53
     * @expectedException \LogicException
54
     * @expectedExceptionMessage Can not get value from null Apn ID object.
55
     */
56
    public function shouldThrowExceptionInGetValueIfIdIsNull()
57
    {
58
        $id = ApnId::fromNull();
59
60
        $id->getValue();
61
    }
62
}
63