From a2aff9a86032d82463af51fdabc87237196de918 Mon Sep 17 00:00:00 2001 From: brantje Date: Sat, 8 Oct 2016 16:30:30 +0200 Subject: [PATCH 1/2] Try to fix phpunit test at travis --- .travis.yml | 2 +- tests/bootstrap.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a0506795..329fc314 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,7 +63,7 @@ script: - sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' = '2' ]; then ./occ app:check-code $APP_NAME -c deprecation; fi" - cd apps/$APP_NAME/ - #- php build/phpunit.phar -c phpunit.xml + - sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then php build/phpunit.phar -c phpunit.xml; fi" # Create coverage report #- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi" diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 995df9a2..f6c58443 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,4 +10,17 @@ */ require_once __DIR__ . '/../../../tests/bootstrap.php'; -require_once __DIR__ . '/../appinfo/autoload.php'; \ No newline at end of file +require_once __DIR__ . '/../appinfo/autoload.php'; + + + +// Fix for "Autoload path not allowed: .../tests/lib/testcase.php" +\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); +// Fix for "Autoload path not allowed: .../activity/tests/testcase.php" +\OC_App::loadApp('activity'); +// Fix for "Autoload path not allowed: .../files/lib/activity.php" +\OC_App::loadApp('files'); +// Fix for "Autoload path not allowed: .../files_sharing/lib/activity.php" +\OC_App::loadApp('files_sharing'); + +OC_Hook::clear(); \ No newline at end of file From 0958c24d516ae73151c8ad2af7883c3f0b75c86b Mon Sep 17 00:00:00 2001 From: brantje Date: Sat, 8 Oct 2016 16:35:29 +0200 Subject: [PATCH 2/2] Add code-coverage --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 329fc314..ea07aab1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,11 +63,11 @@ script: - sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' = '2' ]; then ./occ app:check-code $APP_NAME -c deprecation; fi" - cd apps/$APP_NAME/ - - sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then php build/phpunit.phar -c phpunit.xml; fi" + - sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then php build/phpunit.phar -c phpunit.xml --coverage-clover clover.xml; fi" # Create coverage report - #- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi" - #- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then php ocular.phar code-coverage:upload --format=php-clover clover.xml; fi" + - sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi" + - sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then php ocular.phar code-coverage:upload --format=php-clover clover.xml; fi" #- cd ../ - sh -c "if [ '$JSTESTS' = '1' ]; then grunt jshint; fi"