mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
NEW: Code Coverage via CodeCov.io (#1631)
* Add phpunit.xml.dist for code coverage whitelist * Fixed @covers with namespaces * Increase memory_limit to allow code coverage run. phpdbg can peak to more than 1GB built-in. Travis allows up to 3GB of useable memory: https://docs.travis-ci.com/user/common-build-problems/#My-build-script-is-killed-without-any-error https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments https://github.com/silverstripe/silverstripe-cms/pull/1631
This commit is contained in:
parent
7797ab4e00
commit
0d788ddfbc
@ -34,12 +34,13 @@ matrix:
|
|||||||
- php: 5.6
|
- php: 5.6
|
||||||
env: NPM_TEST=1
|
env: NPM_TEST=1
|
||||||
- php: 7.0
|
- php: 7.0
|
||||||
env: DB=MYSQL PDO=1 PHPUNIT_TEST=1
|
env: DB=MYSQL PDO=1 PHPUNIT_COVERAGE_TEST=1
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- composer self-update || true
|
- composer self-update || true
|
||||||
- phpenv rehash
|
- phpenv rehash
|
||||||
- phpenv config-rm xdebug.ini
|
- phpenv config-rm xdebug.ini
|
||||||
|
- echo 'memory_limit = 2G' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
||||||
- composer install --prefer-dist
|
- composer install --prefer-dist
|
||||||
- "if [ \"$DB\" = \"PGSQL\" ]; then composer require silverstripe/postgresql:2.0.x-dev --prefer-dist; fi"
|
- "if [ \"$DB\" = \"PGSQL\" ]; then composer require silverstripe/postgresql:2.0.x-dev --prefer-dist; fi"
|
||||||
- "if [ \"$DB\" = \"SQLITE\" ]; then composer require silverstripe/sqlite3:2.0.x-dev --prefer-dist; fi"
|
- "if [ \"$DB\" = \"SQLITE\" ]; then composer require silverstripe/sqlite3:2.0.x-dev --prefer-dist; fi"
|
||||||
@ -56,6 +57,8 @@ script:
|
|||||||
- "if [ \"$PHPUNIT_TEST\" = \"1\" ]; then vendor/bin/phpunit tests flush=1; fi"
|
- "if [ \"$PHPUNIT_TEST\" = \"1\" ]; then vendor/bin/phpunit tests flush=1; fi"
|
||||||
- "if [ \"$BEHAT_TEST\" = \"1\" ]; then vendor/bin/behat .; fi"
|
- "if [ \"$BEHAT_TEST\" = \"1\" ]; then vendor/bin/behat .; fi"
|
||||||
- "if [ \"$NPM_TEST\" = \"1\" ]; then (nvm use 4 && npm run lint); fi"
|
- "if [ \"$NPM_TEST\" = \"1\" ]; then (nvm use 4 && npm run lint); fi"
|
||||||
|
- "if [ \"$PHPUNIT_COVERAGE_TEST\" = \"1\" ]; then phpdbg -qrr vendor/bin/phpunit tests flush=1 --coverage-clover=coverage.xml; fi"
|
||||||
|
- "if [ \"$PHPUNIT_COVERAGE_TEST\" = \"1\" ]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi"
|
||||||
|
|
||||||
after_failure:
|
after_failure:
|
||||||
- php ~/travis-support/travis_upload_artifacts.php --if-env BEHAT_TEST,ARTIFACTS_BUCKET,ARTIFACTS_KEY,ARTIFACTS_SECRET --target-path $TRAVIS_REPO_SLUG/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --artifacts-base-url https://s3.amazonaws.com/$ARTIFACTS_BUCKET/
|
- php ~/travis-support/travis_upload_artifacts.php --if-env BEHAT_TEST,ARTIFACTS_BUCKET,ARTIFACTS_KEY,ARTIFACTS_SECRET --target-path $TRAVIS_REPO_SLUG/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --artifacts-base-url https://s3.amazonaws.com/$ARTIFACTS_BUCKET/
|
||||||
|
@ -1,21 +1,3 @@
|
|||||||
<!--
|
|
||||||
PHPUnit configuration for SilverStripe
|
|
||||||
|
|
||||||
Requires PHPUnit 3.5+
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
- "phpunit": Runs all tests in all folders
|
|
||||||
- "phpunit framework/tests/": Run all tests of the framework module
|
|
||||||
- "phpunit framework/tests/filesystem": Run all filesystem tests within the framework module
|
|
||||||
- "phpunit framework/tests/filesystem/FolderTest.php": Run a single test
|
|
||||||
- "phpunit <dash><dash>coverage-html assets/": Generate coverage report (replace <dash> with "-", requires xdebug)
|
|
||||||
|
|
||||||
More information:
|
|
||||||
- http://www.phpunit.de/manual/current/en/textui.html
|
|
||||||
- http://doc.silverstripe.org/framework/en/topics/testing/#configuration
|
|
||||||
|
|
||||||
It is safe to remove this file for normal website operation.
|
|
||||||
-->
|
|
||||||
<phpunit bootstrap="tests/bootstrap.php" colors="true">
|
<phpunit bootstrap="tests/bootstrap.php" colors="true">
|
||||||
|
|
||||||
<testsuite name="Default">
|
<testsuite name="Default">
|
||||||
@ -26,12 +8,6 @@
|
|||||||
<listener class="SilverStripe\Dev\TestListener" />
|
<listener class="SilverStripe\Dev\TestListener" />
|
||||||
</listeners>
|
</listeners>
|
||||||
|
|
||||||
<groups>
|
|
||||||
<exclude>
|
|
||||||
<group>sanitychecks</group>
|
|
||||||
</exclude>
|
|
||||||
</groups>
|
|
||||||
|
|
||||||
<filter>
|
<filter>
|
||||||
<whitelist addUncoveredFilesFromWhitelist="true">
|
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||||
<directory suffix=".php">.</directory>
|
<directory suffix=".php">.</directory>
|
||||||
|
@ -145,7 +145,7 @@ class ContentControllerTest extends FunctionalTest {
|
|||||||
/**
|
/**
|
||||||
* Tests that {@link ContentController::getViewer()} chooses the correct templates.
|
* Tests that {@link ContentController::getViewer()} chooses the correct templates.
|
||||||
*
|
*
|
||||||
* @covers ContentController::getViewer()
|
* @covers SilverStripe\CMS\Controllers\ContentController::getViewer()
|
||||||
**/
|
**/
|
||||||
public function testGetViewer() {
|
public function testGetViewer() {
|
||||||
|
|
||||||
|
@ -838,7 +838,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers SiteTree::validURLSegment
|
* @covers SilverStripe\CMS\Model\SiteTree::validURLSegment
|
||||||
*/
|
*/
|
||||||
public function testValidURLSegmentURLSegmentConflicts() {
|
public function testValidURLSegmentURLSegmentConflicts() {
|
||||||
$sitetree = new SiteTree();
|
$sitetree = new SiteTree();
|
||||||
@ -869,7 +869,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers SiteTree::validURLSegment
|
* @covers SilverStripe\CMS\Model\SiteTree::validURLSegment
|
||||||
*/
|
*/
|
||||||
public function testValidURLSegmentClassNameConflicts() {
|
public function testValidURLSegmentClassNameConflicts() {
|
||||||
$sitetree = new SiteTree();
|
$sitetree = new SiteTree();
|
||||||
@ -879,7 +879,7 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers SiteTree::validURLSegment
|
* @covers SilverStripe\CMS\Model\SiteTree::validURLSegment
|
||||||
*/
|
*/
|
||||||
public function testValidURLSegmentControllerConflicts() {
|
public function testValidURLSegmentControllerConflicts() {
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\SiteTree', 'nested_urls', true);
|
Config::inst()->update('SilverStripe\\CMS\\Model\\SiteTree', 'nested_urls', true);
|
||||||
|
Loading…
Reference in New Issue
Block a user