MDL-38938 behat: Step definition to add glossary entries

This commit is contained in:
David Monllao
2013-04-09 16:01:43 +08:00
parent 422f68fb86
commit 00d373efc5
@@ -0,0 +1,58 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Steps definitions related with the glossary activity.
*
* @package mod_glossary
* @category test
* @copyright 2013 David Monllaó
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
use Behat\Behat\Context\Step\Given as Given,
Behat\Gherkin\Node\TableNode as TableNode,
Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException;
/**
* Glossary-related steps definitions.
*
* @package mod_glossary
* @category test
* @copyright 2013 David Monllaó
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_mod_glossary extends behat_base {
/**
* Adds an entry to the current glossary with the provided data. You should be in the glossary page.
*
* @Given /^I add a glossary entry with the following data:$/
* @param TableNode $data
*/
public function i_add_a_glossary_entry_with_the_following_data(TableNode $data) {
return array(
new Given('I press "' . get_string('addentry', 'mod_glossary') . '"'),
new Given('I fill the moodle form with:', $data),
new Given('I press "Save changes"')
);
}
}