Skip to content

Commit 294e4d3

Browse files
beporterricog
authored andcommitted
Adjust coverage-ensure to work with Cake 3 dir structure.
1 parent 04c8272 commit 294e4d3

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

coverage-ensure

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Usage:
2727
clover.xml - Optional filesystem path to an XML file produced
2828
by PHPunit's code coverage. If absent, the script
2929
will attempt to obtain the correct path using the
30-
project's Config/phpunit.xml file and will exit
30+
project's phpunit.xml[.dist] file and will exit
3131
with an error if this fails.
3232
3333
EOT;
@@ -47,27 +47,30 @@ if (isset($argv[2])) {
4747
$inputFile = $argv[2];
4848
} else {
4949
$baseDir = getcwd();
50-
$phpunitConfigFile = "{$baseDir}/Config/phpunit.xml";
50+
$phpunitConfigFile = "{$baseDir}phpunit.xml";
5151
if (!is_readable($phpunitConfigFile)) {
52-
echo "!! Could not guess path to clover.xml file. Aborting." . PHP_EOL;
53-
exit(2);
52+
$phpunitConfigFile = "{$baseDir}phpunit.xml.dist";
53+
if (!is_readable($phpunitConfigFile)) {
54+
echo "!! Could not guess path to clover.xml file. Aborting." . PHP_EOL;
55+
exit(2);
56+
}
5457
}
5558

5659
$xml = new SimpleXMLElement(file_get_contents($phpunitConfigFile));
5760
$snippet = $xml->xpath('//log[@type="coverage-clover"]');
5861
if (!count($snippet)) {
59-
echo "!! Config/phpunit.xml file does not specify a coverage-clover log. Aborting." . PHP_EOL;
62+
echo "!! phpunit.xml file does not specify a coverage-clover log. Aborting." . PHP_EOL;
6063
exit(3);
6164
}
6265

6366
$snippet = array_pop($snippet);
6467
if (!isset($snippet['target'])) {
65-
echo '!! Config/phpunit.xml: <log type="coverage-clover"> does not specify a `target` attribute. Aborting.' . PHP_EOL;
68+
echo '!! phpunit.xml: <log type="coverage-clover"> does not specify a `target` attribute. Aborting.' . PHP_EOL;
6669
exit(4);
6770
}
6871

6972
$snippet = (string)$snippet['target'];
70-
$inputFile = "{$baseDir}/Config/{$snippet}";
73+
$inputFile = "{$baseDir}/{$snippet}";
7174
}
7275

7376
// Parse the clover report file.

0 commit comments

Comments
 (0)