CurrentIpTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A canReturnTheCurrentIpAddress() 0 7 1
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\Model\Requests;
23
24
use RossMitchell\UpdateCloudFlare\Model\Requests\CurrentIpAddress;
25
use RossMitchell\UpdateCloudFlare\Tests\AbstractTestClass;
26
use RossMitchell\UpdateCloudFlare\Tests\Fakes\Curl;
27
28
/**
29
 * Class CurrentIpTest
30
 * @package RossMitchell\UpdateCloudFlare\Tests\Model\Requests
31
 */
32
class CurrentIpTest extends AbstractTestClass
33
{
34
    /**
35
     * @Inject
36
     * @var CurrentIpAddress
37
     */
38
    private $currentIp;
39
40
    /**
41
     * @Inject
42
     * @var Curl
43
     */
44
    private $curl;
45
46
    /**
47
     * @test
48
     */
49
    public function canReturnTheCurrentIpAddress(): void
50
    {
51
        $expectedIpAddress = '1.2.3.4';
52
        $this->curl->setResponse($expectedIpAddress);
53
        $actualIpAddress = $this->currentIp->getCurrentIpAddress();
54
55
        $this->assertEquals($expectedIpAddress, $actualIpAddress);
56
    }
57
}
58