Code Duplication    Length = 15-16 lines in 4 locations

tests/PipelineNotificationTest.php 3 locations

@@ 28-42 (lines=15) @@
25
	/**
26
	 * Test success notification
27
	 */
28
	public function testSendSuccess() {
29
		$pipeline = $this->getDummyPipeline();
30
31
		// Assert dependencies are injected
32
		$this->assertTrue($pipeline->getMessagingService() instanceof ConfirmationMessagingService);
33
		$pipeline->start();
34
		$this->logInWithPermission('ADMIN');
35
		$pipeline->markComplete();
36
37
		// Assert not error at startup
38
		$this->assertEquals('Complete', $pipeline->Status);
39
		$this->assertHasLog('Pipeline completed successfully.');
40
		$this->assertSentMessage('Deployment for testproject/uat has successfully completed', '[email protected]');
41
		$this->assertSentMessage('Deployment for testproject/uat has successfully completed', '[email protected]');
42
	}
43
44
	/**
45
	 * Test abort
@@ 47-61 (lines=15) @@
44
	/**
45
	 * Test abort
46
	 */
47
	public function testSendAbort() {
48
		$pipeline = $this->getDummyPipeline();
49
50
		// Assert dependencies are injected
51
		$this->assertTrue($pipeline->getMessagingService() instanceof ConfirmationMessagingService);
52
		$pipeline->start();
53
		$this->logInWithPermission('ADMIN');
54
		$pipeline->markAborted();
55
56
		// Assert not error at startup
57
		$this->assertEquals('Aborted', $pipeline->Status);
58
		$this->assertHasLog('Pipeline processing aborted. ADMIN User ([email protected]) aborted the pipeline');
59
		$this->assertSentMessage('Deployment for testproject/uat has been aborted', '[email protected]');
60
		$this->assertSentMessage('Deployment for testproject/uat has been aborted', '[email protected]');
61
	}
62
63
	/**
64
	 * Test abort
@@ 66-81 (lines=16) @@
63
	/**
64
	 * Test abort
65
	 */
66
	public function testSendFailure() {
67
		$pipeline = $this->getDummyPipeline();
68
69
		// Assert dependencies are injected
70
		$this->assertTrue($pipeline->getMessagingService() instanceof ConfirmationMessagingService);
71
		$pipeline->start();
72
		$this->logInWithPermission('ADMIN');
73
		$pipeline->markFailed();
74
75
		// Assert not error at startup
76
		$this->assertEquals('Failed', $pipeline->Status);
77
		$this->assertHasLog('Pipeline failed, not running rollback (not configured or not applicable yet).');
78
		$this->assertSentMessage('Deployment for testproject/uat has failed', '[email protected]');
79
		$this->assertSentMessage('Deployment for testproject/uat has failed', '[email protected]');
80
		$this->assertSentMessage('Deployment for testproject/uat has failed', '[email protected]');
81
	}
82
83
}
84

tests/UserConfirmationStepTest.php 1 location

@@ 171-186 (lines=16) @@
168
		$this->assertSentMessage('Deployment for testproject/uat has been rejected', '[email protected]');
169
	}
170
171
	public function testApproval() {
172
		$step = $this->getDummyConfirmationStep();
173
174
		// Assert dependencies are injected
175
		$this->assertTrue($step->getMessagingService() instanceof ConfirmationMessagingService);
176
		$step->start();
177
		$this->logInWithPermission('ADMIN');
178
		$step->approve();
179
180
		// Assert not error at startup
181
		$this->assertEquals('Finished', $step->Status);
182
		$this->assertEquals('Approved', $step->Approval);
183
		$this->assertHasLog('TestConfirmStep has been approved');
184
		$this->assertSentMessage('Deployment for testproject/uat has been approved', '[email protected]');
185
		$this->assertSentMessage('Deployment for testproject/uat has been approved', '[email protected]');
186
	}
187
}
188