Skip to content

Commit 7d2d6c2

Browse files
committed
Use test assertions instead of throwing exceptions
1 parent b743c81 commit 7d2d6c2

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

tests/integration/ITTrait.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ public function runWpCli(array $args, array $expectWarnings = []): array
1919
$this->assertCount($expectedCount, $matches, "Expected $expectedCount matches for pattern: $pattern");
2020
}
2121

22-
if ($exitCode !== 0) {
23-
throw new \Exception("WP CLI command failed: $cmd\nOutput: " . implode("\n", $output));
24-
}
22+
$this->assertSame(0, $exitCode, "WP CLI command failed: $cmd\nOutput: " . implode("\n", $output));
2523

2624
return ['exit' => $exitCode, 'output' => $output];
2725
}
@@ -31,9 +29,7 @@ public function getCrawledFile(string $path): string
3129
$wordpressDir = ITEnv::getWordPressDir();
3230
$crawledSiteDir = $wordpressDir . '/wp-content/uploads/wp2static-crawled-site';
3331
$content = file_get_contents("{$crawledSiteDir}/$path");
34-
if ($content === false) {
35-
throw new \Exception("Failed to read file: {$crawledSiteDir}/$path");
36-
}
32+
$this->assertNotFalse($content, "Failed to read file: {$crawledSiteDir}/$path");
3733
return $content;
3834
}
3935
}

0 commit comments

Comments
 (0)