Completed
Push — master ( 514484...b41e63 )
by Andrii
01:39
created

TargetTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\tests\unit\target;
12
13
use hiqdev\php\billing\target\TargetCollection;
14
use hiqdev\php\billing\target\Target;
15
16
/**
17
 * @author Andrii Vasyliev <[email protected]>
18
 */
19
class TargetTest extends \PHPUnit\Framework\TestCase
20
{
21
    protected function setUp()
22
    {
23
        $this->aserver = new Target(null, 'server');
24
        $this->server1 = new Target(1111, 'server');
25
        $this->server2 = new Target(2222, 'server');
26
        $this->servers = new TargetCollection([$this->server1, $this->server2]);
27
        $this->adomain = new Target(null, 'domain');
28
        $this->domain1 = new Target(1111, 'domain');
29
        $this->domain2 = new Target(2222, 'domain');
30
        $this->domains = new TargetCollection([$this->domain1, $this->domain2]);
31
    }
32
33
    protected function tearDown()
34
    {
35
    }
36
37
    public function testEquals()
38
    {
39
        $aserver = new Target(null, 'server');
0 ignored issues
show
Unused Code introduced by
$aserver is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
40
        $server1 = new Target(1111, 'server');
41
        $server2 = new Target(2222, 'server');
0 ignored issues
show
Unused Code introduced by
$server2 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
42
        $servers = new TargetCollection([$this->server1, $this->server2]);
0 ignored issues
show
Unused Code introduced by
$servers is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
43
        $adomain = new Target(null, 'domain');
0 ignored issues
show
Unused Code introduced by
$adomain is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
44
        $domain1 = new Target(1111, 'domain');
0 ignored issues
show
Unused Code introduced by
$domain1 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
45
        $domain2 = new Target(2222, 'domain');
0 ignored issues
show
Unused Code introduced by
$domain2 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
46
        $domains = new TargetCollection([$this->domain1, $this->domain2]);
0 ignored issues
show
Unused Code introduced by
$domains is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
47
48
        $this->assertTrue($this->server1->equals($server1));
49
        $this->assertTrue($server1->equals($this->server1));
50
51
        $this->assertFalse($this->server1->equals($this->server2));
52
        $this->assertFalse($this->server2->equals($this->server1));
53
    }
54
}
55