Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Steps definitions related with the glossary activity.
  19   *
  20   * @package    mod_glossary
  21   * @category   test
  22   * @copyright  2013 David MonllaĆ³
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  // NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
  27  
  28  require_once (__DIR__ . '/../../../../lib/behat/behat_base.php');
  29  
  30  use Behat\Gherkin\Node\TableNode as TableNode;
  31  
  32  /**
  33   * Glossary-related steps definitions.
  34   *
  35   * @package    mod_glossary
  36   * @category   test
  37   * @copyright  2013 David MonllaĆ³
  38   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  39   */
  40  class behat_mod_glossary extends behat_base {
  41  
  42      /**
  43       * Adds an entry to the current glossary with the provided data. You should be in the glossary page.
  44       *
  45       * @Given /^I add a glossary entry with the following data:$/
  46       * @param TableNode $data
  47       */
  48      public function i_add_a_glossary_entry_with_the_following_data(TableNode $data) {
  49          $this->execute("behat_forms::press_button", get_string('addentry', 'mod_glossary'));
  50  
  51          $this->execute("behat_forms::i_set_the_following_fields_to_these_values", $data);
  52  
  53          $this->execute("behat_forms::press_button", get_string('savechanges'));
  54      }
  55  
  56      /**
  57       * Adds a category with the specified name to the current glossary. You need to be in the glossary page.
  58       *
  59       * @Given /^I add a glossary entries category named "(?P<category_name_string>(?:[^"]|\\")*)"$/
  60       * @param string $categoryname Category name
  61       */
  62      public function i_add_a_glossary_entries_category_named($categoryname) {
  63  
  64          $this->execute("behat_general::click_link", get_string('categoryview', 'mod_glossary'));
  65  
  66          $this->execute("behat_forms::press_button", get_string('editcategories', 'mod_glossary'));
  67  
  68          $this->execute("behat_forms::press_button", get_string('addcategory', 'glossary'));
  69  
  70          $this->execute('behat_forms::i_set_the_field_to', array('name', $this->escape($categoryname)));
  71  
  72          $this->execute("behat_forms::press_button", get_string('savechanges'));
  73          $this->execute("behat_forms::press_button", get_string('back', 'mod_glossary'));
  74      }
  75  }