Skip to content

Commit 2a1414c

Browse files
committed
Check message before status to get helpful failures
1 parent e6d29b3 commit 2a1414c

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

tests/Phug/Command/AnalyzeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public function testRun()
5252
file_exists($directory) && @shell_exec('rmdir /S /Q '.escapeshellarg($directory).' 2>&1');
5353
@FileSystem::delete($directory);
5454

55-
$this->assertTrue($return);
5655
$this->assertSame(implode("\n", [
5756
'main/package',
5857
'#[1;36m ├ a/b',
@@ -61,6 +60,7 @@ public function testRun()
6160
'#[0m#[1;36m └ main/fuz',
6261
'#[0m',
6362
]), $output);
63+
$this->assertTrue($return);
6464
}
6565

6666
/**
@@ -78,8 +78,8 @@ public function testErrors()
7878
$output = ob_get_contents();
7979
ob_end_clean();
8080

81-
$this->assertFalse($return);
8281
$this->assertSame("#[0;31mInput directory not found.\n#[0m", $output);
82+
$this->assertFalse($return);
8383

8484
$cwd = getcwd();
8585
chdir(__DIR__);
@@ -90,7 +90,7 @@ public function testErrors()
9090
ob_end_clean();
9191
chdir($cwd);
9292

93-
$this->assertFalse($return);
9493
$this->assertSame("#[0;31mRoot project directory should contains a composer.json file.\n#[0m", $output);
94+
$this->assertFalse($return);
9595
}
9696
}

tests/Phug/Command/CopyTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public function testRun()
6767
@FileSystem::delete($directory);
6868
}
6969

70-
$this->assertTrue($return);
7170
$this->assertSame("Copy ended.\n", $output);
71+
$this->assertTrue($return);
7272
$this->assertSame('A', $contentA);
7373
$this->assertSame('B', $contentB);
7474
$this->assertFalse($contentC);
@@ -90,8 +90,8 @@ public function testErrors()
9090
$output = ob_get_contents();
9191
ob_end_clean();
9292

93-
$this->assertFalse($return);
9493
$this->assertSame("#[0;31mPlease provide an input repository URL.\n#[0m", $output);
94+
$this->assertFalse($return);
9595

9696
$cwd = getcwd();
9797
$copy = new Copy();
@@ -140,8 +140,8 @@ public function testErrors()
140140
@FileSystem::delete($directory);
141141
}
142142

143-
$this->assertFalse($return);
144143
$this->assertSame("#[0;31mLast commit must be linked to a mono-repository commit.\n#[0m", $output);
144+
$this->assertFalse($return);
145145
$this->assertFalse($contentA);
146146
$this->assertFalse($contentB);
147147
$this->assertFalse($contentC);
@@ -193,8 +193,8 @@ public function testErrors()
193193
@FileSystem::delete($directory);
194194
}
195195

196-
$this->assertFalse($return);
197196
$this->assertSame("#[0;31mDestination directory \"i-do-not-exist\" does not seem to exist.\n#[0m", $output);
197+
$this->assertFalse($return);
198198
$this->assertFalse($contentA);
199199
$this->assertFalse($contentB);
200200
$this->assertFalse($contentC);

tests/Phug/Command/DistTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ public function testRun()
9292
@FileSystem::delete($directory);
9393
}
9494

95-
$this->assertTrue($return);
9695
$path = $directory1.DIRECTORY_SEPARATOR;
9796
$expected = implode("\n", [
9897
'vendor/package',
@@ -104,6 +103,7 @@ public function testRun()
104103
'#[0m',
105104
]);
106105
$this->assertSame($expected, $output);
106+
$this->assertTrue($return);
107107
$this->assertSame('D', $contentD);
108108
$this->assertSame('E', $contentE);
109109
$this->assertSame('F', $contentF);
@@ -125,8 +125,8 @@ public function testErrors()
125125
$output = ob_get_contents();
126126
ob_end_clean();
127127

128-
$this->assertFalse($return);
129128
$this->assertSame("#[0;31mRoot project directory should contains a composer.json file.\n#[0m", $output);
129+
$this->assertFalse($return);
130130

131131
$cwd = getcwd();
132132
$dist = new Dist();
@@ -154,8 +154,8 @@ public function testErrors()
154154
file_exists($directory) && @shell_exec('rmdir /S /Q ' . escapeshellarg($directory) . ' 2>&1');
155155
@FileSystem::delete($directory);
156156

157-
$this->assertFalse($return);
158157
$this->assertSame("vendor/package\n#[0;31mUnable to create output directory.\n#[0m", $output);
158+
$this->assertFalse($return);
159159

160160
$dist = new Dist();
161161

@@ -192,10 +192,10 @@ public function testErrors()
192192
@FileSystem::delete($directory);
193193
}
194194

195-
$this->assertFalse($return);
196195
$this->assertSame(
197196
"vendor/sub-package\n#[0;31mYou must be on a branch in a git repository to run this command.\n#[0m",
198197
$output
199198
);
199+
$this->assertFalse($return);
200200
}
201201
}

0 commit comments

Comments
 (0)