From 249f7cb78b62695b82ef2f1fbc30b53c9e76f3ff Mon Sep 17 00:00:00 2001 From: Daniel Thee Roperto Date: Wed, 6 Sep 2017 11:46:03 +1000 Subject: [PATCH] Making it compatible with Moodle 32+. --- .travis.yml | 21 +++++++++++++++++---- tests/phpunit/base_testcase.php | 11 +++++++++++ tests/phpunit/local/cli/cli_testcase.php | 1 - tests/phpunit/local/outagelib_test.php | 7 ++++++- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index a44b02b..a3b754c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,15 +9,29 @@ cache: directories: - $HOME/.composer/cache +addons: + postgresql: "9.3" + php: - - 5.5 - 7.0 env: - DB=pgsql MOODLE_BRANCH=MOODLE_30_STABLE - DB=pgsql MOODLE_BRANCH=MOODLE_31_STABLE - - DB=mysqli MOODLE_BRANCH=MOODLE_30_STABLE - - DB=mysqli MOODLE_BRANCH=MOODLE_31_STABLE + - DB=pgsql MOODLE_BRANCH=MOODLE_32_STABLE + - DB=pgsql MOODLE_BRANCH=MOODLE_33_STABLE + - DB=pgsql MOODLE_BRANCH=master + - DB=mysqli MOODLE_BRANCH=master + +matrix: + include: + - php: 5.5 + env: DB=pgsql MOODLE_BRANCH=MOODLE_30_STABLE + - php: 5.5 + env: DB=mysqli MOODLE_BRANCH=MOODLE_30_STABLE + - php: 7.1 + env: DB=pgsql MOODLE_BRANCH=master + before_install: - phpenv config-rm xdebug.ini @@ -39,4 +53,3 @@ script: - moodle-plugin-ci shifter - moodle-plugin-ci jshint - moodle-plugin-ci phpunit - - moodle-plugin-ci behat diff --git a/tests/phpunit/base_testcase.php b/tests/phpunit/base_testcase.php index 3b9face..91a03fd 100644 --- a/tests/phpunit/base_testcase.php +++ b/tests/phpunit/base_testcase.php @@ -63,4 +63,15 @@ abstract class auth_outage_base_testcase extends advanced_testcase { } } } + + public function setUp() { + global $CFG; + + parent::setUp(); + $this->resetAfterTest(true); + + // Do not use https. + $CFG->wwwroot = 'http://www.example.com/moodle'; + $CFG->httpswwwroot = $CFG->wwwroot; + } } diff --git a/tests/phpunit/local/cli/cli_testcase.php b/tests/phpunit/local/cli/cli_testcase.php index 6a2914c..47412a7 100644 --- a/tests/phpunit/local/cli/cli_testcase.php +++ b/tests/phpunit/local/cli/cli_testcase.php @@ -52,7 +52,6 @@ abstract class auth_outage_cli_testcase extends auth_outage_base_testcase { \core\session\manager::gc(); // Remove stale sessions. core_plugin_manager::reset_caches(); - $this->resetAfterTest(true); $this->set_parameters([]); parent::setUp(); } diff --git a/tests/phpunit/local/outagelib_test.php b/tests/phpunit/local/outagelib_test.php index bc48793..f7e380a 100644 --- a/tests/phpunit/local/outagelib_test.php +++ b/tests/phpunit/local/outagelib_test.php @@ -24,7 +24,6 @@ */ use auth_outage\dml\outagedb; -use auth_outage\local\controllers\infopage; use auth_outage\local\outage; use auth_outage\local\outagelib; @@ -106,6 +105,8 @@ class outagelib_test extends advanced_testcase { $size = strlen($CFG->additionalhtmltopofbody); outagelib::inject(); self::assertSame($size, strlen($CFG->additionalhtmltopofbody)); + + $this->resetDebugging(); // Function pix_url deprecated in Moodle 33+. } /** @@ -141,6 +142,8 @@ class outagelib_test extends advanced_testcase { outagelib::reinject(); self::assertContains('