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

shouldSuccessCreateForDevelopmentMode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
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\Protocol\Http\UriFactory;
13
14
use Apple\ApnPush\Model\DeviceToken;
15
use Apple\ApnPush\Protocol\Http\UriFactory\UriFactory;
16
use PHPUnit\Framework\TestCase;
17
18
class UriFactoryTest extends TestCase
19
{
20
    /**
21
     * @var UriFactory
22
     */
23
    private $uriFactory;
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    protected function setUp()
29
    {
30
        $this->uriFactory = new UriFactory();
31
    }
32
33
    /**
34
     * @test
35
     */
36
    public function shouldSuccessCreateForProductionMode()
37
    {
38
        $token = new DeviceToken(str_repeat('af', 32));
39
        $uri = $this->uriFactory->create($token, false);
40
41
        self::assertEquals(
42
            'https://api.push.apple.com/3/device/afafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafaf',
43
            $uri
44
        );
45
    }
46
47
    /**
48
     * @test
49
     */
50
    public function shouldSuccessCreateForDevelopmentMode()
51
    {
52
        $token = new DeviceToken(str_repeat('aa', 32));
53
        $uri = $this->uriFactory->create($token, true);
54
55
        self::assertEquals(
56
            'https://api.development.push.apple.com/3/device/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
57
            $uri
58
        );
59
    }
60
}
61