]> git.agnieray.net Git - galette.git/commitdiff
Enable code coverage on travis runs, send to scrutinizer
authorJohan Cwiklinski <johan@x-tnd.be>
Sun, 14 Jun 2020 21:13:12 +0000 (23:13 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 14 Jun 2020 21:50:01 +0000 (23:50 +0200)
.travis.yml
tests/clover.php [new file with mode: 0644]

index 65418650d414d00b60c914af93373a88005c6d1e..51aeffe3e144c7854ea42cc96aff9a03485de5e4 100644 (file)
@@ -13,9 +13,14 @@ before_script:
 
 script:
   - if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.4" && $DB == "mysql" ]]; then galette/vendor/bin/phpcs -n -p --ignore=galette_tcpdf_config.php --standard=phpcs-rules.xml galette/lib/ tests/ galette/webroot/index.php galette/includes/fields_defs/ galette/includes/smarty_plugins/ galette/includes/functions.inc.php galette/includes/galette.inc.php galette/includes/dependencies.php galette/includes/main.inc.php; fi
-  - php galette/vendor/bin/atoum -mcn 1 -bf tests/TestsBootstrap.php -d tests/Galette/
+  - php galette/vendor/bin/atoum -mcn 1 -bf tests/TestsBootstrap.php -c tests/clover.php -d tests/Galette/
   - php galette/cron/reminder.php
 
+after_script:
+  ## Scrutinizer
+  - wget https://scrutinizer-ci.com/ocular.phar
+  - if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.4" && $DB == "pgsql" ]]; then php ocular.phar code-coverage:upload --format=php-clover tests/clover.xml; fi
+
 language: php
 
 php:
diff --git a/tests/clover.php b/tests/clover.php
new file mode 100644 (file)
index 0000000..dcfba30
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Atoum code coverage in clover format, for scrutinizer
+ * To use it, you can choose either:
+ *  * php path/to/test/file -c path/to/this/file
+ *  * php path/to/atoum/scripts/runner.php -c path/to/this/file -f path/to/test/file
+ *
+ * PHP version 5
+ *
+ * Copyright © 2020 The Galette Team
+ *
+ * This file is part of Galette (http://galette.tuxfamily.org).
+ *
+ * Galette is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Galette is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Galette. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Core
+ * @package   GaletteTests
+ *
+ * @author    Johan Cwiklinski <johan@x-tnd.be>
+ * @copyright 2020 The Galette Team
+ * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
+ * @link      http://galette.tuxfamily.org
+ * @since     2020-06-14
+ */
+
+use mageekguy\atoum;
+
+$script->addDefaultReport();
+
+$cloverWriter = new atoum\writers\file(__DIR__ . '/clover.xml');
+$cloverReport = new atoum\reports\asynchronous\clover();
+$cloverReport->addWriter($cloverWriter);
+
+$runner->addReport($cloverReport);