Add running PHP unit test coverage reports in CircleCI
This commit is contained in:
15
RoboFile.php
15
RoboFile.php
@ -114,15 +114,20 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$this->_exec($command);
|
$this->_exec($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCoverage($file = null) {
|
function testCoverage($opts=['file' => null, 'xml' => false]) {
|
||||||
$this->loadEnv();
|
$this->loadEnv();
|
||||||
$this->_exec('vendor/bin/codecept build');
|
$this->_exec('vendor/bin/codecept build');
|
||||||
$this->_exec(join(' ', array(
|
$command = join(' ', array(
|
||||||
'vendor/bin/codecept run',
|
'vendor/bin/codecept run',
|
||||||
(($file) ? $file : ''),
|
(($opts['file']) ? $opts['file'] : ''),
|
||||||
'--coverage',
|
'--coverage',
|
||||||
'--coverage-html'
|
($opts['xml']) ? '--coverage-xml' : '--coverage-html'
|
||||||
)));
|
));
|
||||||
|
|
||||||
|
if($opts['xml']) {
|
||||||
|
$command .= ' --xml';
|
||||||
|
}
|
||||||
|
$this->_exec($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testJavascript($xml_output_file = null) {
|
function testJavascript($xml_output_file = null) {
|
||||||
|
10
circle.yml
10
circle.yml
@ -31,6 +31,10 @@ dependencies:
|
|||||||
# Create .env file with correct path to WP installation
|
# Create .env file with correct path to WP installation
|
||||||
- echo "WP_TEST_PATH=\"/home/ubuntu/mailpoet/wordpress\"" > .env
|
- echo "WP_TEST_PATH=\"/home/ubuntu/mailpoet/wordpress\"" > .env
|
||||||
|
|
||||||
|
# Enable XDebug for coverage reports.
|
||||||
|
# Comment out if not running PHP coverage reports, for performance
|
||||||
|
- sed -i 's/^;//' /opt/circleci/php/$(phpenv global)/etc/conf.d/xdebug.ini
|
||||||
|
|
||||||
## tests override
|
## tests override
|
||||||
test:
|
test:
|
||||||
override:
|
override:
|
||||||
@ -39,7 +43,11 @@ test:
|
|||||||
- ./do t:j $CIRCLE_TEST_REPORTS/mocha/junit.xml
|
- ./do t:j $CIRCLE_TEST_REPORTS/mocha/junit.xml
|
||||||
|
|
||||||
# Run PHP tests
|
# Run PHP tests
|
||||||
- ./do t:u --xml
|
#- ./do t:u --xml
|
||||||
|
# Uncomment to run coverage tests instead
|
||||||
|
- ./do t:c --xml
|
||||||
# Copy the report
|
# Copy the report
|
||||||
- mkdir $CIRCLE_TEST_REPORTS/codeception
|
- mkdir $CIRCLE_TEST_REPORTS/codeception
|
||||||
- cp tests/_output/report.xml $CIRCLE_TEST_REPORTS/codeception/report.xml
|
- cp tests/_output/report.xml $CIRCLE_TEST_REPORTS/codeception/report.xml
|
||||||
|
# Uncomment to copy PHP coverage report
|
||||||
|
- cp tests/_output/coverage.xml $CIRCLE_TEST_REPORTS/codeception/coverage.xml
|
||||||
|
Reference in New Issue
Block a user