From b79a70d1228412e2c5e8258dbfce1fe189389724 Mon Sep 17 00:00:00 2001 From: Daniel Thee Roperto Date: Mon, 26 Sep 2016 11:17:57 +1000 Subject: [PATCH] Issue #46 - Fixed moodle-plugin-ci warnings. --- classes/local/cli/clibase.php | 3 ++- tests/behat/behat_auth_outage.php | 11 ++++------- tests/phpunit/cli/cli_test.php | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/classes/local/cli/clibase.php b/classes/local/cli/clibase.php index 064f5a6..6c19ee5 100644 --- a/classes/local/cli/clibase.php +++ b/classes/local/cli/clibase.php @@ -20,7 +20,6 @@ use coding_exception; use core\session\manager; defined('MOODLE_INTERNAL') || die(); -require_once($CFG->libdir.'/clilib.php'); /** * Outage CLI base class. @@ -48,6 +47,8 @@ abstract class clibase { */ public function __construct(array $options = null) { global $CFG; + require_once($CFG->libdir.'/clilib.php'); + if (!is_enabled_auth('outage')) { throw new cli_exception(get_string('cliplugindisabled', 'auth_outage'), cli_exception::ERROR_PLUGIN_DISABLED); } diff --git a/tests/behat/behat_auth_outage.php b/tests/behat/behat_auth_outage.php index bb52726..b9c23ca 100644 --- a/tests/behat/behat_auth_outage.php +++ b/tests/behat/behat_auth_outage.php @@ -27,9 +27,6 @@ use auth_outage\dml\outagedb; use auth_outage\local\outage; -use Behat\Behat\Tester\Exception\PendingException; -use Behat\Gherkin\Node\TableNode; -use Behat\Mink\Exception\ElementNotFoundException; use Behat\Mink\Exception\ExpectationException; require_once(__DIR__.'/../../../../lib/behat/behat_base.php'); @@ -59,8 +56,8 @@ class behat_auth_outage extends behat_base { $this->getSession()->visit($this->locate_path('login/index.php')); // Enter username and password. - $this->execute('behat_forms::i_set_the_field_to', array('Username', $this->escape('admin'))); - $this->execute('behat_forms::i_set_the_field_to', array('Password', $this->escape('admin'))); + $this->execute('behat_forms::i_set_the_field_to', ['Username', $this->escape('admin')]); + $this->execute('behat_forms::i_set_the_field_to', ['Password', $this->escape('admin')]); // Press log in button, no need to check for exceptions as it will checked after this step execution. $this->execute('behat_forms::press_button', get_string('login')); @@ -139,7 +136,7 @@ class behat_auth_outage extends behat_base { private function can_i_see_action($action) { $selector = 'css'; - $locator = "div[role='main'] a[title='${action}']"; + $locator = "div[role='main'] a[title='".$action."']"; $items = $this->getSession()->getPage()->findAll($selector, $locator); return count($items); } @@ -148,7 +145,7 @@ class behat_auth_outage extends behat_base { * @Then I click on the :action action button */ public function i_click_on_the_action_button($action) { - $node = $this->get_selected_node('css_element', "div[role='main'] table nobr a[title='${action}']"); + $node = $this->get_selected_node('css_element', "div[role='main'] table nobr a[title='".$action."']"); $this->ensure_node_is_visible($node); $node->click(); } diff --git a/tests/phpunit/cli/cli_test.php b/tests/phpunit/cli/cli_test.php index d26425a..2b6cdb8 100644 --- a/tests/phpunit/cli/cli_test.php +++ b/tests/phpunit/cli/cli_test.php @@ -89,7 +89,7 @@ class cli_test extends cli_testcase { set_config('auth', ''); \core\session\manager::gc(); // Remove stale sessions. core_plugin_manager::reset_caches(); - // Try to create an CLI - $cli = new create(); + // Try to create an CLI object. + new create(); } }