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

DeploymentTest::testGetPreviousVersion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
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