Skip to content

Commit cfd514a

Browse files
committed
script update coverage report
1 parent 3bb0b07 commit cfd514a

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
},
2323
"scripts": {
2424
"test": "./vendor/bin/phpunit --coverage-text --colors",
25-
"test-with-report": "./vendor/bin/phpunit --configuration phpunit.xml --coverage-clover test-reports/cov.xml"
25+
"test-with-report": "./vendor/bin/phpunit --configuration phpunit.xml --coverage-clover test-reports/cov.xml && php prepare-coverage-report.php"
2626
}
2727
}

prepare-coverage-report.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
// Path to the Clover XML file
3+
$coverageFile = './test-reports/cov.xml';
4+
5+
// Load the file contents
6+
$xmlContent = file_get_contents($coverageFile);
7+
8+
// Replace "/var/www/html" with "."
9+
$updatedContent = str_replace('/var/www/html', '.', $xmlContent);
10+
11+
// Save the updated content back to the file
12+
file_put_contents($coverageFile, $updatedContent);
13+
14+
echo "Clover report updated successfully!\n";

test-reports/cov.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<coverage generated="1724124780">
3-
<project timestamp="1724124780">
2+
<coverage generated="1724126968">
3+
<project timestamp="1724126968">
44
<file name="./src/Exceptions/AccessException.php">
55
<class name="Brispot\PhpLib\Exceptions\AccessException" namespace="global">
66
<metrics complexity="1" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="5" coveredstatements="5" elements="6" coveredelements="6"/>

0 commit comments

Comments
 (0)