Completed
Pull Request — master (#513)
by Helpful
04:05
created

DeploymentPipelineStepTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 207
Duplicated Lines 7.25 %

Coupling/Cohesion

Components 1
Dependencies 8
Metric Value
wmc 8
lcom 1
cbo 8
dl 15
loc 207
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getDummyDeployment() 15 15 2
B testSuccessful() 0 34 1
A testSnapshotFailure() 0 20 1
A testSnapshotSkipped() 0 13 1
B testDeploymentFailure() 0 32 1
A testDelayedSuccess() 0 47 1
A testTimeout() 0 21 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
class DeploymentPipelineStepTest extends PipelineTest {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
5
	protected static $fixture_file = 'PipelineTest.yml';
6
7
	/**
8
	 * Makes the dummy deployment step
9
	 *
10
	 * @return DeploymentPipelineStep
11
	 */
12 View Code Duplication
	public function getDummyDeployment($newEnv = false) {
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...
13
		$deployStep = $this->objFromFixture('DeploymentPipelineStep', 'testdeploy');
14
		$deployStep->Config = serialize(array('MaxDuration' => '3600'));
15
		$deployStep->write();
16
		$pipeline = $deployStep->Pipeline();
17
18
		// simulates a new environment that hasn't got any current build
19
		if($newEnv) {
20
			$pipeline->EnvironmentID = $this->idFromFixture('PipelineTest_Environment', 'newenvironment');
21
		}
22
23
		$pipeline->Config = serialize(array());
24
		$pipeline->write();
25
		return $deployStep;
26
	}
27
28
	public function testSuccessful() {
29
		$step = $this->getDummyDeployment();
30
		$step->start();
31
32
		// Assert not error at startup
33
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
		$this->assertEquals('Snapshot', $step->Doing);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Snapshot creating snapshot of database'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
37
		// Mark the snapshot as completed and check result
38
		$snapshot = $step->Pipeline()->PreviousSnapshot();
39
		$snapshot->markFinished();
0 ignored issues
show
Documentation Bug introduced by
The method markFinished does not exist on object<DNDataTransfer>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
40
41
		// Retry step
42
		PipelineTest_MockLog::clear();
43
		$step->start();
44
45
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
		$this->assertEquals('Deployment', $step->Doing);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
47
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Deployment starting deployment'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
48
49
		// Mark the service as completed and check result
50
		$author = $this->objFromFixture('Member', 'author');
51
		$deployment = $step->Pipeline()->CurrentDeployment();
52
		$this->assertEquals($deployment->DeployerID, $author->ID);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
53
		$deployment->markFinished();
0 ignored issues
show
Documentation Bug introduced by
The method markFinished does not exist on object<DNDeployment>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
54
55
		// Retry step
56
		PipelineTest_MockLog::clear();
57
		$step->start();
58
		$this->assertEquals('Finished', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
59
		$this->assertTrue(PipelineTest_MockLog::has_message('Checking status of TestDeployStep:Deployment...'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
60
		$this->assertTrue(PipelineTest_MockLog::has_message('Step finished successfully!'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
61
	}
62
63
	/**
64
	 * Test failure at the snapshot step
65
	 */
66
	public function testSnapshotFailure() {
67
		$step = $this->getDummyDeployment();
68
		$step->start();
69
70
		// Assert not error at startup
71
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
72
		$this->assertEquals('Snapshot', $step->Doing);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
73
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Snapshot creating snapshot of database'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
74
75
		// Mark the service as completed and check result
76
		$snapshot = $step->Pipeline()->PreviousSnapshot();
77
		$snapshot->markFailed();
0 ignored issues
show
Documentation Bug introduced by
The method markFailed does not exist on object<DNDataTransfer>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
78
79
		// Retry step
80
		PipelineTest_MockLog::clear();
81
		$step->start();
82
		$this->assertEquals('Failed', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
83
		$this->assertTrue(PipelineTest_MockLog::has_message('Checking status of TestDeployStep:Snapshot...'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
84
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Snapshot failed with task status Failed'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
85
	}
86
87
	/**
88
	 * Test snapshot is skipped when environment has no build
89
	 */
90
	public function testSnapshotSkipped() {
91
		$step = $this->getDummyDeployment(true);
92
		$step->start();
93
94
		// Assert not error at startup
95
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
96
		$this->assertEquals('Snapshot', $step->Doing);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
97
		$this->assertTrue(PipelineTest_MockLog::has_message('[Skipped] No current build, skipping snapshot'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
98
99
		// Mark the service as completed and check result
100
		$snapshot = $step->Pipeline()->PreviousSnapshot();
101
		$this->assertFalse($snapshot->exists(), 'No snapshot was created');
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
102
	}
103
104
	/**
105
	 * Test failure at the deployment step
106
	 */
107
	public function testDeploymentFailure() {
108
		$step = $this->getDummyDeployment();
109
		$step->start();
110
111
		// Assert not error at startup
112
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
113
		$this->assertEquals('Snapshot', $step->Doing);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
114
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Snapshot creating snapshot of database'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
115
116
		// Mark the snapshot as completed and check result
117
		$snapshot = $step->Pipeline()->PreviousSnapshot();
118
		$snapshot->markFinished();
0 ignored issues
show
Documentation Bug introduced by
The method markFinished does not exist on object<DNDataTransfer>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
119
120
		// Retry step
121
		PipelineTest_MockLog::clear();
122
		$step->start();
123
124
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
125
		$this->assertEquals('Deployment', $step->Doing);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
126
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Deployment starting deployment'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
127
128
		// Mark the service as completed and check result
129
		$deployment = $step->Pipeline()->CurrentDeployment();
130
		$deployment->markFailed();
0 ignored issues
show
Documentation Bug introduced by
The method markFailed does not exist on object<DNDeployment>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
131
132
		// Retry step
133
		PipelineTest_MockLog::clear();
134
		$step->start();
135
		$this->assertEquals('Failed', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
136
		$this->assertTrue(PipelineTest_MockLog::has_message('Checking status of TestDeployStep:Deployment...'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
137
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Deployment failed with task status Failed'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
138
	}
139
140
	public function testDelayedSuccess() {
141
		$step = $this->getDummyDeployment();
142
		$step->start();
143
144
		// Assert not error at startup
145
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
146
		$this->assertEquals('Snapshot', $step->Doing);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
147
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Snapshot creating snapshot of database'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
148
149
		// Retry step
150
		PipelineTest_MockLog::clear();
151
		$step->start();
152
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
153
		$this->assertEquals('Snapshot', $step->Doing);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
154
		$this->assertTrue(PipelineTest_MockLog::has_message('Checking status of TestDeployStep:Snapshot...'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
155
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Snapshot is still in progress'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
156
157
		// Mark the snapshot as completed and check result
158
		$snapshot = $step->Pipeline()->PreviousSnapshot();
159
		$snapshot->markFinished();
0 ignored issues
show
Documentation Bug introduced by
The method markFinished does not exist on object<DNDataTransfer>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
160
161
		// Advance to deployment
162
		PipelineTest_MockLog::clear();
163
		$step->start();
164
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
165
		$this->assertEquals('Deployment', $step->Doing);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
166
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Deployment starting deployment'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
167
168
		// Retry step
169
		PipelineTest_MockLog::clear();
170
		$step->start();
171
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
172
		$this->assertEquals('Deployment', $step->Doing);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
173
		$this->assertTrue(PipelineTest_MockLog::has_message('Checking status of TestDeployStep:Deployment...'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
174
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Deployment is still in progress'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
175
176
		// Mark the service as completed and check result
177
		$deployment = $step->Pipeline()->CurrentDeployment();
178
		$deployment->markFinished();
0 ignored issues
show
Documentation Bug introduced by
The method markFinished does not exist on object<DNDeployment>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
179
180
		// Retry step
181
		PipelineTest_MockLog::clear();
182
		$step->start();
183
		$this->assertEquals('Finished', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
184
		$this->assertTrue(PipelineTest_MockLog::has_message('Checking status of TestDeployStep:Deployment...'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
185
		$this->assertTrue(PipelineTest_MockLog::has_message('Step finished successfully!'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
186
	}
187
188
	public function testTimeout() {
189
		$step = $this->getDummyDeployment();
190
		$step->start();
191
192
		// Assert not error at startup
193
		$this->assertEquals('Started', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
194
		$this->assertTrue(PipelineTest_MockLog::has_message('TestDeployStep:Snapshot creating snapshot of database'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
195
196
		// Go to two hours into the future
197
		SS_Datetime::set_mock_now(date('Y-m-d H:i:s', strtotime('+2 hours')));
198
199
		// Retry step
200
		PipelineTest_MockLog::clear();
201
		$step->start();
202
		$this->assertEquals('Failed', $step->Status);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
203
		$this->assertTrue($step->isTimedOut());
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
204
		$this->assertTrue(PipelineTest_MockLog::has_message('Checking status of TestDeployStep:Snapshot...'));
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
205
		$this->assertTrue(PipelineTest_MockLog::has_message(
1 ignored issue
show
Bug introduced by
The method assertTrue() does not seem to exist on object<DeploymentPipelineStepTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
206
			'TestDeployStep:Snapshot took longer than 3600 seconds to run and has timed out'
207
		));
208
	}
209
}
210