From 596f2d72aa8891d190bd1ffa4e819222b98208e1 Mon Sep 17 00:00:00 2001 From: Daniel Thee Roperto Date: Mon, 15 May 2017 09:11:24 +1000 Subject: [PATCH] Issue #13 - Updated Travis and unit test. - Added Moodle 32 and Moodle 33 to Travis. - Updated Travis to not test mysql in every scenario - Updated Travis to use Postgres 9.3 (required by Moodle 33+) - Updated test_that_user_logged_in_and_redirected as newer Moodle defaults to different URL. --- .travis.yml | 50 +++++++++++++++++--------------------- tests/auth_plugin_test.php | 3 ++- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7238d57..3153dc8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,43 +1,37 @@ language: php -notifications: - email: - recipients: - -sudo: false - cache: directories: - $HOME/.composer/cache php: - - 5.6 + - 5.6 + - 7.0 + +addons: + postgresql: "9.3" env: - matrix: - - DB=pgsql MOODLE_BRANCH=MOODLE_29_STABLE - - DB=pgsql MOODLE_BRANCH=MOODLE_30_STABLE - - DB=pgsql MOODLE_BRANCH=MOODLE_31_STABLE - - DB=pgsql MOODLE_BRANCH=master - - DB=mysqli MOODLE_BRANCH=MOODLE_29_STABLE - - DB=mysqli MOODLE_BRANCH=MOODLE_30_STABLE - - DB=mysqli MOODLE_BRANCH=MOODLE_31_STABLE - - DB=mysqli MOODLE_BRANCH=master + global: + - DB=pgsql # There is not enough database usage to justify full check with mysqli too. + matrix: + - MOODLE_BRANCH=MOODLE_30_STABLE + - MOODLE_BRANCH=MOODLE_31_STABLE + - MOODLE_BRANCH=MOODLE_32_STABLE + - MOODLE_BRANCH=MOODLE_33_STABLE + - MOODLE_BRANCH=master matrix: include: - - php: 7.0 - env: DB=pgsql MOODLE_BRANCH=MOODLE_30_STABLE - - php: 7.0 - env: DB=pgsql MOODLE_BRANCH=MOODLE_31_STABLE - - php: 7.0 - env: DB=pgsql MOODLE_BRANCH=master - - php: 7.0 - env: DB=mysqli MOODLE_BRANCH=MOODLE_30_STABLE - - php: 7.0 - env: DB=mysqli MOODLE_BRANCH=MOODLE_31_STABLE + # Test old Moodle in PHP 5.6 only + - php: 5.6 + env: MOODLE_BRANCH=MOODLE_29_STABLE + # Test MySQL - php: 7.0 env: DB=mysqli MOODLE_BRANCH=master + # Test PHP 7.1 + - php: 7.1 + env: MOODLE_BRANCH=master before_install: - cd ../.. @@ -46,7 +40,7 @@ before_install: - export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH" install: - - moodle-plugin-ci install + - moodle-plugin-ci install -vvv script: - moodle-plugin-ci phplint @@ -56,4 +50,4 @@ script: - moodle-plugin-ci shifter - moodle-plugin-ci jshint - moodle-plugin-ci phpunit - - moodle-plugin-ci behat \ No newline at end of file + - moodle-plugin-ci behat diff --git a/tests/auth_plugin_test.php b/tests/auth_plugin_test.php index ee7db07..bde01e7 100644 --- a/tests/auth_plugin_test.php +++ b/tests/auth_plugin_test.php @@ -901,7 +901,7 @@ class auth_plugin_userkey_testcase extends advanced_testcase { * @expectedExceptionMessage Unsupported redirect to http://www.example.com/moodle detected, execution terminated. */ public function test_that_user_logged_in_and_redirected() { - global $DB; + global $DB, $CFG; $key = new stdClass(); $key->value = 'UserLogin'; @@ -913,6 +913,7 @@ class auth_plugin_userkey_testcase extends advanced_testcase { $key->timecreated = time(); $DB->insert_record('user_private_key', $key); + $CFG->wwwroot = 'http://www.example.com/moodle'; $_POST['key'] = 'UserLogin'; @$this->auth->user_login_userkey(); }