1 |
efrain |
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('addsingleentry', '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 |
$params = [
|
|
|
64 |
get_string('categoryview', 'mod_glossary'),
|
|
|
65 |
get_string('explainalphabet', 'glossary')
|
|
|
66 |
];
|
|
|
67 |
$this->execute("behat_forms::i_select_from_the_singleselect", $params);
|
|
|
68 |
$this->execute("behat_forms::press_button", get_string('editcategories', 'mod_glossary'));
|
|
|
69 |
|
|
|
70 |
$this->execute("behat_forms::press_button", get_string('addcategory', 'glossary'));
|
|
|
71 |
|
|
|
72 |
$this->execute('behat_forms::i_set_the_field_to', array('name', $this->escape($categoryname)));
|
|
|
73 |
|
|
|
74 |
$this->execute("behat_forms::press_button", get_string('savechanges'));
|
|
|
75 |
$this->execute("behat_forms::press_button", get_string('back', 'mod_glossary'));
|
|
|
76 |
}
|
|
|
77 |
}
|