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 |
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
|
|
|
18 |
|
|
|
19 |
use Behat\Gherkin\Node\TableNode as TableNode;
|
|
|
20 |
|
|
|
21 |
require_once(__DIR__ . '/../../../../lib/behat/behat_deprecated_base.php');
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
/**
|
|
|
25 |
* Steps definitions that are now deprecated and will be removed in the next releases.
|
|
|
26 |
*
|
|
|
27 |
* This file only contains the steps that previously were in the behat_*.php files in the SAME DIRECTORY.
|
|
|
28 |
* When deprecating steps from other components or plugins, create a behat_COMPONENT_deprecated.php
|
|
|
29 |
* file in the same directory where the steps were defined.
|
|
|
30 |
*
|
|
|
31 |
* @package mod_data
|
|
|
32 |
* @category test
|
|
|
33 |
* @copyright 2024 Amaia Anabitarte <amaia@moodle.com>
|
|
|
34 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
35 |
*/
|
|
|
36 |
class behat_mod_data_deprecated extends behat_deprecated_base
|
|
|
37 |
{
|
|
|
38 |
|
|
|
39 |
/**
|
|
|
40 |
* Adds a new field to a database
|
|
|
41 |
*
|
|
|
42 |
* @Given /^I add a "(?P<fieldtype_string>(?:[^"]|\\")*)" field to "(?P<activityname_string>(?:[^"]|\\")*)" database and I fill the form with:$/
|
|
|
43 |
*
|
|
|
44 |
* @param string $fieldtype
|
|
|
45 |
* @param string $activityname
|
|
|
46 |
* @param TableNode $fielddata
|
|
|
47 |
* @todo MDL-79721 This will be deleted in Moodle 4.8.
|
|
|
48 |
*
|
|
|
49 |
* @deprecated since 4.4
|
|
|
50 |
*/
|
|
|
51 |
public function i_add_a_field_to_database_and_i_fill_the_form_with($fieldtype, $activityname, TableNode $fielddata)
|
|
|
52 |
{
|
|
|
53 |
$this->deprecated_message([
|
|
|
54 |
'behat_mod_data::i_add_a_field_to_database_and_i_fill_the_form_with is deprecated',
|
|
|
55 |
'mod_data > fields generator',
|
|
|
56 |
]);
|
|
|
57 |
|
|
|
58 |
$this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($activityname), 'data activity']);
|
|
|
59 |
|
|
|
60 |
$fieldsstr = get_string('fields', 'mod_data');
|
|
|
61 |
|
|
|
62 |
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", $fieldsstr);
|
|
|
63 |
$this->execute('behat_general::i_click_on', [get_string('newfield', 'mod_data'), "button"]);
|
|
|
64 |
$this->execute('behat_general::i_click_on_in_the',
|
|
|
65 |
[$this->escape($fieldtype), "link", "#action_bar", "css_element"]
|
|
|
66 |
);
|
|
|
67 |
|
|
|
68 |
if (!$this->running_javascript()) {
|
|
|
69 |
$this->execute('behat_general::i_click_on_in_the',
|
|
|
70 |
array(get_string('go'), "button", ".fieldadd", "css_element")
|
|
|
71 |
);
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $fielddata);
|
|
|
75 |
$this->execute('behat_forms::press_button', get_string('save'));
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
/**
|
|
|
79 |
* Adds an entry to a database.
|
|
|
80 |
*
|
|
|
81 |
* @Given /^I add an entry to "(?P<activityname_string>(?:[^"]|\\")*)" database with:$/
|
|
|
82 |
*
|
|
|
83 |
* @param string $activityname
|
|
|
84 |
* @param TableNode $entrydata
|
|
|
85 |
* @deprecated since 4.4
|
|
|
86 |
* @todo MDL-79721 This will be deleted in Moodle 4.8.
|
|
|
87 |
*
|
|
|
88 |
*/
|
|
|
89 |
public function i_add_an_entry_to_database_with($activityname, TableNode $entrydata)
|
|
|
90 |
{
|
|
|
91 |
$this->deprecated_message([
|
|
|
92 |
'behat_mod_data::i_add_an_entry_to_database_with is deprecated',
|
|
|
93 |
'mod_data > entries generator',
|
|
|
94 |
]);
|
|
|
95 |
|
|
|
96 |
$this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($activityname), 'mod_data > add entry']);
|
|
|
97 |
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $entrydata);
|
|
|
98 |
}
|
|
|
99 |
}
|