Skip to content

Commit e02f1e7

Browse files
More work on merge error handling
1 parent 8a70aa9 commit e02f1e7

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

src/cli/MergeCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public function run(Arguments $arguments): int
2929
return 1;
3030
}
3131

32+
if (!$arguments->reportConfigured()) {
33+
print 'No code coverage report configured' . PHP_EOL;
34+
35+
return 1;
36+
}
37+
3238
$files = (new Facade)->getFilesAsArray(
3339
$arguments->directory(),
3440
['.cov']

tests/end-to-end/merge/directory-without-cov-files.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
--TEST--
2-
phpcov merge ../../fixture/empty-directory
2+
phpcov merge --text coverage.txt ../../fixture/empty-directory
33
--INI--
44
xdebug.overload_var_dump=0
55
--FILE--
66
<?php declare(strict_types=1);
77
require __DIR__ . '/../../../vendor/autoload.php';
88

99
$_SERVER['argv'][1] = 'merge';
10-
$_SERVER['argv'][2] = __DIR__ . '/../../fixture/empty-directory';
10+
$_SERVER['argv'][2] = '--text';
11+
$_SERVER['argv'][3] = 'coverage.txt';
12+
$_SERVER['argv'][4] = __DIR__ . '/../../fixture/empty-directory';
1113

1214
var_dump((new SebastianBergmann\PHPCOV\Application)->run($_SERVER['argv']));
1315
--EXPECTF--
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
phpcov merge --text /tmp/file ../../fixture/example/coverage
3+
--INI--
4+
xdebug.overload_var_dump=0
5+
--FILE--
6+
<?php declare(strict_types=1);
7+
require __DIR__ . '/../../../vendor/autoload.php';
8+
9+
$_SERVER['argv'][1] = 'merge';
10+
$_SERVER['argv'][2] = __DIR__ . '/../../fixture/example/coverage';
11+
12+
var_dump((new SebastianBergmann\PHPCOV\Application)->run($_SERVER['argv']));
13+
--EXPECTF--
14+
phpcov %s by Sebastian Bergmann.
15+
16+
No code coverage report configured
17+
int(1)

0 commit comments

Comments
 (0)