Skip to content

Commit

Permalink
Allow views directory to be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Apr 10, 2018
1 parent 39067ea commit 2189220
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Phug/Tester/Coverage.php
Expand Up @@ -380,6 +380,10 @@ public function dumpCoverage(bool $output = false, string $directory = null)
$files = [];
$this->tree = [];
foreach ($this->getPaths() as $path) {
if (!is_dir($path)) {
continue;
}

foreach ($this->renderer->scanDirectory($path) as $file) {
$coveredState = 0;
$file = realpath($file);
Expand Down Expand Up @@ -441,9 +445,9 @@ public function dumpCoverage(bool $output = false, string $directory = null)
if ($directory) {
$this->writeSummaries($directory);
}
$pad = max(array_map(function ($path) {
$pad = max(array_pad(array_map(function ($path) {
return strlen($path);
}, array_keys($files))) + 3;
}, array_keys($files)), 1, 0)) + 3;
$coveredNodes = 0;
$nodes = 0;
foreach ($files as $file => $stats) {
Expand Down Expand Up @@ -492,6 +496,14 @@ public function createRenderer($renderer, array $options = []): Renderer
return $renderer;
}

/**
* @return Renderer
*/
public function getRenderer(): Renderer
{
return $this->renderer;
}

/**
* @param int $threshold
*/
Expand Down

0 comments on commit 2189220

Please sign in to comment.