Skip to content

Commit 4e4454f

Browse files
committed
Throw more granular exceptions from SampleManager.php
This eased debugging a lot.
1 parent c7fc82d commit 4e4454f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/integration/SampleManager.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,12 @@ public function write($path, array $replacements)
9090

9191
$sampleFile = rtrim($this->basePath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $path;
9292

93-
if (!file_exists($sampleFile) || !is_readable($sampleFile)) {
94-
throw new \RuntimeException(sprintf("%s either does not exist or is not readable", $sampleFile));
93+
if (!file_exists($sampleFile)) {
94+
throw new \RuntimeException(sprintf("%s does not exist", $sampleFile));
95+
}
96+
97+
if(!is_readable($sampleFile)) {
98+
throw new \RuntimeException(sprintf("%s is not readable", $sampleFile));
9599
}
96100

97101
$content = strtr(file_get_contents($sampleFile), $replacements);

0 commit comments

Comments
 (0)