Skip to content

Commit 2189220

Browse files
committed
Allow views directory to be empty
1 parent 39067ea commit 2189220

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/Phug/Tester/Coverage.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,10 @@ public function dumpCoverage(bool $output = false, string $directory = null)
380380
$files = [];
381381
$this->tree = [];
382382
foreach ($this->getPaths() as $path) {
383+
if (!is_dir($path)) {
384+
continue;
385+
}
386+
383387
foreach ($this->renderer->scanDirectory($path) as $file) {
384388
$coveredState = 0;
385389
$file = realpath($file);
@@ -441,9 +445,9 @@ public function dumpCoverage(bool $output = false, string $directory = null)
441445
if ($directory) {
442446
$this->writeSummaries($directory);
443447
}
444-
$pad = max(array_map(function ($path) {
448+
$pad = max(array_pad(array_map(function ($path) {
445449
return strlen($path);
446-
}, array_keys($files))) + 3;
450+
}, array_keys($files)), 1, 0)) + 3;
447451
$coveredNodes = 0;
448452
$nodes = 0;
449453
foreach ($files as $file => $stats) {
@@ -492,6 +496,14 @@ public function createRenderer($renderer, array $options = []): Renderer
492496
return $renderer;
493497
}
494498

499+
/**
500+
* @return Renderer
501+
*/
502+
public function getRenderer(): Renderer
503+
{
504+
return $this->renderer;
505+
}
506+
495507
/**
496508
* @param int $threshold
497509
*/

0 commit comments

Comments
 (0)