Completed
Push — master ( 2f2459...d82a91 )
by Ross
02:33
created

canCreateTheClassUsingTheFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
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\Factories\Requests;
23
24
use RossMitchell\UpdateCloudFlare\Data\IpType;
25
use RossMitchell\UpdateCloudFlare\Factories\Requests\DnsRecordsFactory;
26
use RossMitchell\UpdateCloudFlare\Requests\DnsRecords;
27
use RossMitchell\UpdateCloudFlare\Tests\AbstractTestClass;
28
29
/**
30
 * Class DnsRecordsFactoryTest
31
 * @testdox RossMitchell\UpdateCloudFlare\Factories\Requests\DnsRecordsFactory
32
 * @package RossMitchell\UpdateCloudFlare\Tests\Factories\Requests
33
 */
34
class DnsRecordsFactoryTest extends AbstractTestClass
35
{
36
    /**
37
     * @Inject
38
     * @var DnsRecordsFactory
39
     */
40
    private $factory;
41
42
    /**
43
     * @test
44
     */
45
    public function canCreateTheClassUsingTheFactory()
46
    {
47
        $class = $this->createClass();
48
        $this->assertInstanceOf(DnsRecords::class, $class);
49
    }
50
51
    /**
52
     * @test
53
     */
54
    public function itSetsTheRequiredParameters()
55
    {
56
        $class = $this->createClass();
57
        $this->assertEquals('www', $class->getSubDomainInfo()->getSubDomain());
58
        $this->assertEquals(IpType::IP_V4, $class->getSubDomainInfo()->getIpType());
59
        $this->assertEquals('12345', $class->getSubDomainInfo()->getZoneId());
60
    }
61
62
    private function createClass(string $subDomain = 'www', string $type = IpType::IP_V4, string $zoneId = '12345')
63
    {
64
        return $this->factory->create($subDomain, $type, $zoneId);
65
    }
66
}
67