Completed
Push — master ( e57500...6b1ea1 )
by Michael
05:04
created

DeploymentTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 7
dl 0
loc 56
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 15 1
A testGetEnvironment() 0 7 1
A testGetPreviousVersion() 0 7 1
A testGetCurrentVersion() 0 7 1
A testGetServer() 0 7 1
1
<?php
2
3
namespace ParityBit\DeploymentNotifier;
4
5
class DeploymentTest extends \PHPUnit_Framework_TestCase
6
{
7
    protected $faker;
8
    protected $previousVersion;
9
    protected $currentVersion;
10
    protected $environment;
11
    protected $server;
12
13
    public function setUp()
14
    {
15
        $this->faker = \Faker\Factory::create();
16
        $this->previousVersion = new Version($this->faker->word);
17
        $this->currentVersion = new Version($this->faker->word);
18
        $this->environment = new Environment($this->faker->word);
19
        $this->server = new Server($this->faker->word);
20
21
        $this->deployment = new Deployment(
0 ignored issues
show
Bug introduced by
The property deployment does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
22
            $this->environment,
23
            $this->previousVersion,
24
            $this->currentVersion,
25
            $this->server
26
        );
27
    }
28
29
    public function testGetEnvironment()
30
    {
31
        $this->assertEquals(
32
            $this->environment,
33
            $this->deployment->getEnvironment()
34
        );
35
    }
36
37
    public function testGetPreviousVersion()
38
    {
39
        $this->assertEquals(
40
            $this->previousVersion,
41
            $this->deployment->getPreviousVersion()
42
        );
43
    }
44
45
    public function testGetCurrentVersion()
46
    {
47
        $this->assertEquals(
48
            $this->currentVersion,
49
            $this->deployment->getCurrentVersion()
50
        );
51
    }
52
53
    public function testGetServer()
54
    {
55
        $this->assertEquals(
56
            $this->server,
57
            $this->deployment->getServer()
58
        );
59
    }
60
}
61