[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/mod/glossary/tests/behat/ -> behat_mod_glossary.php (source)

   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\Behat\Context\Step\Given as Given,
  31      Behat\Gherkin\Node\TableNode as TableNode;
  32  
  33  /**
  34   * Glossary-related steps definitions.
  35   *
  36   * @package    mod_glossary
  37   * @category   test
  38   * @copyright  2013 David Monllaó
  39   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  40   */
  41  class behat_mod_glossary extends behat_base {
  42  
  43      /**
  44       * Adds an entry to the current glossary with the provided data. You should be in the glossary page.
  45       *
  46       * @Given /^I add a glossary entry with the following data:$/
  47       * @param TableNode $data
  48       */
  49      public function i_add_a_glossary_entry_with_the_following_data(TableNode $data) {
  50          return array(
  51              new Given('I press "' . get_string('addentry', 'mod_glossary') . '"'),
  52              new Given('I set the following fields to these values:', $data),
  53              new Given('I press "' . get_string('savechanges') . '"')
  54          );
  55      }
  56  
  57      /**
  58       * Adds a category with the specified name to the current glossary. You need to be in the glossary page.
  59       *
  60       * @Given /^I add a glossary entries category named "(?P<category_name_string>(?:[^"]|\\")*)"$/
  61       * @param string $categoryname Category name
  62       */
  63      public function i_add_a_glossary_entries_category_named($categoryname) {
  64  
  65          return array(
  66              new Given('I follow "' . get_string('categoryview', 'mod_glossary') . '"'),
  67              new Given('I press "' . get_string('editcategories', 'mod_glossary') . '"'),
  68              new Given('I press "' . get_string('add').' '.get_string('category', 'glossary') . '"'),
  69              new Given('I set the field "name" to "' . $this->escape($categoryname) . '"'),
  70              new Given('I press "' . get_string('savechanges') . '"'),
  71              new Given('I press "' . get_string('back', 'mod_glossary') . '"')
  72          );
  73      }
  74  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1