ListZonesResultTest::canReturnThePermissions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

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 7
nc 1
nop 0
1
<?php declare(strict_types = 1);
2
/**
3
 *
4
 * Copyright (C) 2018  Ross Mitchell
5
 *
6
 * This file is part of RossMitchell/UpdateCloudFlare.
7
 *
8
 * RossMitchell/UpdateCloudFlare is free software: you can redistribute
9
 * it and/or modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation, either version 3 of the
11
 * License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
namespace RossMitchell\UpdateCloudFlare\Tests\Responses\Results\ListZoneResult;
23
24
use RossMitchell\UpdateCloudFlare\Responses\Results\ListZonesResult;
25
use RossMitchell\UpdateCloudFlare\Responses\Results\Owner;
26
use RossMitchell\UpdateCloudFlare\Responses\Results\Plan;
27
28
/**
29
 * Class ListZonesResultTest
30
 * @testdox RossMitchell\UpdateCloudFlare\Responses\Results\ListZonesResult
31
 * @package RossMitchell\UpdateCloudFlare\Tests\Responses\Results
32
 */
33
class ListZonesResultTest extends AbstractClass
34
{
35
    /**
36
     * @test
37
     */
38
    public function canBeCreatedUsingTheFactory(): void
39
    {
40
        $class = $this->createClass();
41
        $this->assertInstanceOf(ListZonesResult::class, $class);
42
    }
43
44
    /**
45
     * @test
46
     */
47
    public function canReturnTheId(): void
48
    {
49
        $class = $this->createClass();
50
        $this->assertEquals('023e105f4ecef8ad9ca31a8372d0c353', $class->getId());
51
    }
52
53
    /**
54
     * @test
55
     */
56
    public function canReturnTheName(): void
57
    {
58
        $class = $this->createClass();
59
        $this->assertEquals('example.com', $class->getName());
60
    }
61
62
    /**
63
     * @test
64
     */
65
    public function canReturnTheDevelopmentMode(): void
66
    {
67
        $class = $this->createClass();
68
        $this->assertEquals(7200, $class->getDevelopmentMode());
69
    }
70
71
    /**
72
     * @test
73
     */
74
    public function canReturnTheOriginalNameServers(): void
75
    {
76
        $class       = $this->createClass();
77
        $expected    = [
78
            'ns1.originaldnshost.com',
79
            'ns2.originaldnshost.com',
80
        ];
81
        $nameServers = $class->getOriginalNameServers();
82
        $this->assertInternalType('array', $nameServers);
83
        $this->assertEquals($expected, $nameServers);
84
    }
85
86
    /**
87
     * @test
88
     */
89
    public function canReturnTheOriginalRegistrar(): void
90
    {
91
        $class = $this->createClass();
92
        $this->assertEquals('GoDaddy', $class->getOriginalRegistrar());
93
    }
94
95
    /**
96
     * @test
97
     */
98
    public function canReturnTheOriginalDnsHost(): void
99
    {
100
        $class = $this->createClass();
101
        $this->assertEquals('NameCheap', $class->getOriginalDnsHost());
102
    }
103
104
    /**
105
     * @test
106
     */
107
    public function canReturnTheCreatedOn(): void
108
    {
109
        $class = $this->createClass();
110
        $this->assertEquals('2014-01-01T05:20:00.12345Z', $class->getCreatedOn());
111
    }
112
113
    /**
114
     * @test
115
     */
116
    public function canReturnTheModifiedOn(): void
117
    {
118
        $class = $this->createClass();
119
        $this->assertEquals('2014-01-01T05:20:00.12345Z', $class->getModifiedOn());
120
    }
121
122
    /**
123
     * @test
124
     */
125
    public function canReturnTheOwner(): void
126
    {
127
        $class = $this->createClass();
128
        $this->assertInstanceOf(Owner::class, $class->getOwner());
129
    }
130
131
    /**
132
     * @test
133
     */
134
    public function canReturnThePermissions(): void
135
    {
136
        $class       = $this->createClass();
137
        $expected    = [
138
            '#zone:read',
139
            '#zone:edit',
140
        ];
141
        $permissions = $class->getPermissions();
142
        $this->assertInternalType('array', $permissions);
143
        $this->assertEquals($expected, $permissions);
144
    }
145
146
    /**
147
     * @test
148
     */
149
    public function canReturnThePlan(): void
150
    {
151
        $class = $this->createClass();
152
        $this->assertInstanceOf(Plan::class, $class->getPlan());
153
    }
154
155
    /**
156
     * @test
157
     */
158
    public function canReturnThePlanPending(): void
159
    {
160
        $class = $this->createClass();
161
        $this->assertInstanceOf(Plan::class, $class->getPlanPending());
162
    }
163
164
    /**
165
     * @test
166
     */
167
    public function canReturnTheStatus(): void
168
    {
169
        $class = $this->createClass();
170
        $this->assertEquals('active', $class->getStatus());
171
    }
172
173
    /**
174
     * @test
175
     */
176
    public function canReturnIsPaused(): void
177
    {
178
        $class = $this->createClass();
179
        $this->assertFalse($class->isPaused());
180
    }
181
182
    /**
183
     * @test
184
     */
185
    public function canReturnTheType(): void
186
    {
187
        $class = $this->createClass();
188
        $this->assertEquals('full', $class->getType());
189
    }
190
191
    /**
192
     * @test
193
     */
194
    public function canReturnTheNameServers(): void
195
    {
196
        $class       = $this->createClass();
197
        $expected    = [
198
            'tony.ns.cloudflare.com',
199
            'woz.ns.cloudflare.com',
200
        ];
201
        $nameServers = $class->getNameServers();
202
        $this->assertInternalType('array', $nameServers);
203
        $this->assertEquals($expected, $nameServers);
204
    }
205
}
206