IPAddressTests::testIsEmpty()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 12
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 12
loc 12
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the Cubiche/Web component.
5
 *
6
 * Copyright (c) Cubiche
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 Cubiche\Domain\Web\Tests\Units;
13
14
use Cubiche\Domain\Web\IPAddress;
15
16
/**
17
 * IPAddressTests class.
18
 *
19
 * Generated by TestGenerator on 2017-03-15 at 11:36:08.
20
 */
21
class IPAddressTests extends HostTestCase
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function randomNativeValue()
27
    {
28
        return $this->faker->ipv6;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function invalidNativeValue()
35
    {
36
        return 'wrong@ip';
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    protected function uniqueNativeValue()
43
    {
44
        return $this->faker->unique()->ipv4;
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    protected function fromNative($value)
51
    {
52
        return IPAddress::fromNative($value);
53
    }
54
55
    /**
56
     * Test isEmpty method.
57
     */
58 View Code Duplication
    public function testIsEmpty()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
59
    {
60
        $this
61
            ->given($email = IPAddress::fromNative($this->randomNativeValue()))
62
            ->then()
63
                ->boolean($email->isEmpty())
64
                    ->isFalse()
65
                ->exception(function () {
66
                    IPAddress::fromNative('');
67
                })->isInstanceOf(\InvalidArgumentException::class)
68
        ;
69
    }
70
}
71