Completed
Pull Request — master (#513)
by Helpful
04:05
created
tests/DryRunPipelineTest.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -125,6 +125,7 @@
 block discarded – undo
125 125
 	/**
126 126
 	 * Make the dummy deployment step
127 127
 	 *
128
+	 * @param string $name
128 129
 	 * @return SmokeTestPipelineStep
129 130
 	 */
130 131
 	public function getDummySmokeTestStep($name) {
Please login to merge, or discard this patch.
tests/PipelineTest.php 2 patches
Doc Comments   +13 added lines patch added patch discarded remove patch
@@ -36,14 +36,23 @@  discard block
 block discarded – undo
36 36
 		PipelineTest_RecordingMessageSender::clear();
37 37
 	}
38 38
 
39
+	/**
40
+	 * @param string $message
41
+	 */
39 42
 	protected function assertHasLog($message) {
40 43
 		$this->assertTrue(PipelineTest_MockLog::has_message($message), "Assert log \"$message\"");
41 44
 	}
42 45
 
46
+	/**
47
+	 * @param string $message
48
+	 */
43 49
 	protected function assertNotLogged($message) {
44 50
 		$this->assertFalse(PipelineTest_MockLog::has_message($message), "Assert not logged \"$message\"");
45 51
 	}
46 52
 
53
+	/**
54
+	 * @param string $recipient
55
+	 */
47 56
 	public function assertSentMessage($message, $recipient) {
48 57
 		$this->assertTrue(
49 58
 			PipelineTest_RecordingMessageSender::has_message($message, $recipient),
@@ -51,6 +60,10 @@  discard block
 block discarded – undo
51 60
 		);
52 61
 	}
53 62
 
63
+	/**
64
+	 * @param string $message
65
+	 * @param string $recipient
66
+	 */
54 67
 	public function assertNotSentMessage($message, $recipient) {
55 68
 		$this->assertFalse(
56 69
 			PipelineTest_RecordingMessageSender::has_message($message, $recipient),
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -102,7 +102,9 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public static function has_message($test) {
104 104
 		foreach(self::$messages as $message) {
105
-			if(strpos($message, $test) !== false) return true;
105
+			if(strpos($message, $test) !== false) {
106
+				return true;
107
+			}
106 108
 		}
107 109
 		return false;
108 110
 	}
@@ -122,8 +124,12 @@  discard block
 block discarded – undo
122 124
 
123 125
 	public static function has_message($test, $recipient = null) {
124 126
 		foreach(self::$messages as $message) {
125
-			if($message[1] !== $test) continue;
126
-			if($recipient && $message[0] === $recipient) return true;
127
+			if($message[1] !== $test) {
128
+				continue;
129
+			}
130
+			if($recipient && $message[0] === $recipient) {
131
+				return true;
132
+			}
127 133
 		}
128 134
 		return false;
129 135
 	}
Please login to merge, or discard this patch.
tests/SimplePackageGeneratorTest.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -58,6 +58,7 @@
 block discarded – undo
58 58
 	/**
59 59
 	 * Create a simple temporary git repo at the given path, for component testing,
60 60
 	 * and return the SHA of the EHAD
61
+	 * @param string $path
61 62
 	 */
62 63
 	protected function createTempGitRepo($path) {
63 64
 		$CLI_path = escapeshellarg($path);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	public function setUp() {
12 12
 		// We muck with the filesystem, create one folder that contains all the stuff we create,
13 13
 		// and delete it entirely on tearDown()
14
-		$this->tempPath = TEMP_FOLDER . '/SimplePackageGeneratorTest-' . rand(1000000,9999999);
14
+		$this->tempPath = TEMP_FOLDER . '/SimplePackageGeneratorTest-' . rand(1000000, 9999999);
15 15
 		mkdir($this->tempPath);
16 16
 
17 17
 	}
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function testGeneratePackage() {
27 27
 		// Build some precursor state for the test
28
-		$gitPath = $this->tempPath .'/git-repo';
29
-		$packagePath = $this->tempPath .'/test.tar.gz';
28
+		$gitPath = $this->tempPath . '/git-repo';
29
+		$packagePath = $this->tempPath . '/test.tar.gz';
30 30
 		$sha = $this->createTempGitRepo($gitPath);
31 31
 		$this->assertNotEmpty($sha);
32 32
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@
 block discarded – undo
16 16
 
17 17
 	}
18 18
 	public function tearDown() {
19
-		if($this->tempPath) Filesystem::removeFolder($this->tempPath);
19
+		if($this->tempPath) {
20
+			Filesystem::removeFolder($this->tempPath);
21
+		}
20 22
 	}
21 23
 
22 24
 	/**
Please login to merge, or discard this patch.
tests/SmokeTestPipelineStepTest.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -7,6 +7,7 @@
 block discarded – undo
7 7
 	/**
8 8
 	 * Make the dummy deployment step
9 9
 	 *
10
+	 * @param string $name
10 11
 	 * @return SmokeTestPipelineStep
11 12
 	 */
12 13
 	public function getDummySmokeTestStep($name) {
Please login to merge, or discard this patch.
tests/AbstractPipelineTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 
81 81
 		// Confirm the correct abort link is generated
82 82
 		$this->assertEquals($pipeline->Link('abort'),
83
-			'naut/project/Project 1/environment/env1/pipeline/'.$pipeline->ID.'/abort');
83
+			'naut/project/Project 1/environment/env1/pipeline/' . $pipeline->ID . '/abort');
84 84
 	}
85 85
 
86 86
 	public function testCanCancelPipeline() {
Please login to merge, or discard this patch.
tests/DNDataArchiveTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -120,25 +120,25 @@  discard block
 block discarded – undo
120 120
 
121 121
 	public function testValidateArchiveContentsAll() {
122 122
 		$archive = DNDataArchive::create();
123
-		$archive->ArchiveFile()->Filename = __DIR__.'/sspaks/all.sspak';
123
+		$archive->ArchiveFile()->Filename = __DIR__ . '/sspaks/all.sspak';
124 124
 		$result = $archive->validateArchiveContents('all');
125 125
 		$this->assertTrue($result->valid());
126 126
 	}
127 127
 
128 128
 	public function testValidateArchiveContentsDB() {
129 129
 		$archive = DNDataArchive::create();
130
-		$archive->ArchiveFile()->Filename = __DIR__.'/sspaks/all.sspak';
130
+		$archive->ArchiveFile()->Filename = __DIR__ . '/sspaks/all.sspak';
131 131
 		$result = $archive->validateArchiveContents('db');
132 132
 		$this->assertTrue($result->valid());
133 133
 
134
-		$archive->ArchiveFile()->Filename = __DIR__.'/sspaks/db.sspak';
134
+		$archive->ArchiveFile()->Filename = __DIR__ . '/sspaks/db.sspak';
135 135
 		$result = $archive->validateArchiveContents('db');
136 136
 		$this->assertTrue($result->valid());
137 137
 	}
138 138
 
139 139
 	public function testValidateArchiveContentsDBFails() {
140 140
 		$archive = DNDataArchive::create();
141
-		$archive->ArchiveFile()->Filename = __DIR__.'/sspaks/assets.sspak';
141
+		$archive->ArchiveFile()->Filename = __DIR__ . '/sspaks/assets.sspak';
142 142
 		$result = $archive->validateArchiveContents('db');
143 143
 		$this->assertFalse($result->valid());
144 144
 		$this->assertEquals('The snapshot is missing the database.', current($result->messageList()));
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
 
147 147
 	public function testValidateArchiveContentsAssets() {
148 148
 		$archive = DNDataArchive::create();
149
-		$archive->ArchiveFile()->Filename = __DIR__.'/sspaks/all.sspak';
149
+		$archive->ArchiveFile()->Filename = __DIR__ . '/sspaks/all.sspak';
150 150
 		$result = $archive->validateArchiveContents('assets');
151 151
 		$this->assertTrue($result->valid());
152 152
 
153
-		$archive->ArchiveFile()->Filename = __DIR__.'/sspaks/assets.sspak';
153
+		$archive->ArchiveFile()->Filename = __DIR__ . '/sspaks/assets.sspak';
154 154
 		$result = $archive->validateArchiveContents('assets');
155 155
 		$this->assertTrue($result->valid());
156 156
 	}
157 157
 
158 158
 	public function testValidateArchiveContentsAssetsFails() {
159 159
 		$archive = DNDataArchive::create();
160
-		$archive->ArchiveFile()->Filename = __DIR__.'/sspaks/db.sspak';
160
+		$archive->ArchiveFile()->Filename = __DIR__ . '/sspaks/db.sspak';
161 161
 		$result = $archive->validateArchiveContents('assets');
162 162
 		$this->assertFalse($result->valid());
163 163
 		$this->assertEquals('The snapshot is missing assets.', current($result->messageList()));
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 
166 166
 	public function testValidateArchiveContentsFileMissingFails() {
167 167
 		$archive = DNDataArchive::create();
168
-		$filename = __DIR__.'/sspaks/not.found.sspak';
168
+		$filename = __DIR__ . '/sspaks/not.found.sspak';
169 169
 		$archive->ArchiveFile()->Filename = $filename;
170 170
 		$result = $archive->validateArchiveContents('all');
171 171
 		$this->assertFalse($result->valid());
172
-		$this->assertEquals('SSPak file "'.$filename.'" cannot be read.', current($result->messageList()));
172
+		$this->assertEquals('SSPak file "' . $filename . '" cannot be read.', current($result->messageList()));
173 173
 	}
174 174
 }
Please login to merge, or discard this patch.
tests/DNProjectTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function testOnBeforeWriteShouldNotCreateCapFolder() {
24 24
 		$this->assertTrue(file_exists($this->envPath));
25
-		$this->assertFalse(file_exists($this->envPath.'/testproject'));
25
+		$this->assertFalse(file_exists($this->envPath . '/testproject'));
26 26
 		$this->project->onBeforeWrite();
27
-		$this->assertFalse(file_exists($this->envPath.'/testproject'), 'Folder should not have been created');
27
+		$this->assertFalse(file_exists($this->envPath . '/testproject'), 'Folder should not have been created');
28 28
 	}
29 29
 
30 30
 	public function testOnBeforeWriteShouldCreateCapFolder() {
31 31
 		$this->assertTrue(file_exists($this->envPath));
32
-		$this->assertFalse(file_exists($this->envPath.'/testproject'));
32
+		$this->assertFalse(file_exists($this->envPath . '/testproject'));
33 33
 		$this->project->CreateEnvFolder = true;
34 34
 		$this->project->onBeforeWrite();
35
-		$this->assertTrue(file_exists($this->envPath.'/testproject'), 'Folder should have been created');
35
+		$this->assertTrue(file_exists($this->envPath . '/testproject'), 'Folder should have been created');
36 36
 	}
37 37
 
38 38
 	public function testSetCreateProjectFolderFieldNoFolderExists() {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 	public function testSetCreateProjectFolderFieldFolderExists() {
47 47
 		$this->assertFalse(
48
-			file_exists($this->envPath.'/'.$this->project->Name),
48
+			file_exists($this->envPath . '/' . $this->project->Name),
49 49
 			'project folder shouldnt exist prior to save'
50 50
 		);
51 51
 		$this->project->CreateEnvFolder = true;
Please login to merge, or discard this patch.
tests/DeploynautTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 			'DNData' => array(
21 21
 				'properties' => array(
22 22
 					'EnvironmentDir' => $this->envPath,
23
-					'KeyDir' => TEMP_FOLDER .'/deploynaut_test/gitkeys',
23
+					'KeyDir' => TEMP_FOLDER . '/deploynaut_test/gitkeys',
24 24
 					'DataTransferDir' => Director::baseFolder() . '/assets/transfers',
25 25
 					'GitUser' => ''
26 26
 				)
Please login to merge, or discard this patch.
tests/SizeRestrictedPackageCacheTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@
 block discarded – undo
13 13
 	public function setUp() {
14 14
 		// We muck with the filesystem, create one folder that contains all the stuff we create,
15 15
 		// and delete it entirely on tearDown()
16
-		$this->tempPath = TEMP_FOLDER . '/PackageCacheTest-' . rand(1000000,9999999);
16
+		$this->tempPath = TEMP_FOLDER . '/PackageCacheTest-' . rand(1000000, 9999999);
17 17
 		mkdir($this->tempPath);
18 18
 
19 19
 		$this->cache = new SizeRestrictedPackageCache;
20 20
 		$this->cache->setCacheSize(3);
21
-		mkdir($this->tempPath .'/cache');
22
-		$this->cache->setBaseDir($this->tempPath .'/cache');
21
+		mkdir($this->tempPath . '/cache');
22
+		$this->cache->setBaseDir($this->tempPath . '/cache');
23 23
 
24 24
 		$this->gen = new PackageCacheTest_MockGenerator;
25 25
 		// To do: refactor so as not to be pipelinetest-specific (see also SimplePackageGeneratorTest)
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@
 block discarded – undo
27 27
 
28 28
 	}
29 29
 	public function tearDown() {
30
-		if($this->tempPath) Filesystem::removeFolder($this->tempPath);
30
+		if($this->tempPath) {
31
+			Filesystem::removeFolder($this->tempPath);
32
+		}
31 33
 	}
32 34
 
33 35
 
Please login to merge, or discard this patch.