Skip to content

Commit

Permalink
TestCase throws an Exception if the file is not readable
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Hujer authored and VasekPurchart committed Sep 21, 2017
1 parent aea5f96 commit 2543915
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/Sniffs/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ public function __construct(string $name = null, array $data = [], string $dataN

protected function checkFile(string $filePath): PhpCsFile
{
if (!is_readable($filePath)) {
throw new \Exception(sprintf(
'File "%s" is not readable',
$filePath
));
}

$codeSniffer = new PhpCsRunner();
$codeSniffer->config = new PhpCsConfig([
'-s', // showSources must be on, so that errors are recorded
Expand Down

0 comments on commit 2543915

Please sign in to comment.