[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
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 database activity. 19 * 20 * @package mod_data 21 * @category test 22 * @copyright 2014 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 * Database-related steps definitions. 33 * 34 * @package mod_data 35 * @category test 36 * @copyright 2014 David Monllaó 37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 38 */ 39 class behat_mod_data extends behat_base { 40 41 /** 42 * Adds a new field to a database 43 * 44 * @Given /^I add a "(?P<fieldtype_string>(?:[^"]|\\")*)" field to "(?P<activityname_string>(?:[^"]|\\")*)" database and I fill the form with:$/ 45 * 46 * @param string $fieldtype 47 * @param string $activityname 48 * @param TableNode $fielddata 49 */ 50 public function i_add_a_field_to_database_and_i_fill_the_form_with($fieldtype, $activityname, TableNode $fielddata) { 51 52 $this->execute("behat_general::click_link", $this->escape($activityname)); 53 $this->execute("behat_general::click_link", get_string('fields', 'mod_data')); 54 55 $this->execute('behat_forms::i_set_the_field_to', array('newtype', $this->escape($fieldtype))); 56 57 if (!$this->running_javascript()) { 58 $this->execute('behat_general::i_click_on_in_the', 59 array(get_string('go'), "button", ".fieldadd", "css_element") 60 ); 61 } 62 63 $this->execute("behat_forms::i_set_the_following_fields_to_these_values", $fielddata); 64 $this->execute('behat_forms::press_button', get_string('add')); 65 } 66 67 /** 68 * Adds an entry to a database. 69 * 70 * @Given /^I add an entry to "(?P<activityname_string>(?:[^"]|\\")*)" database with:$/ 71 * 72 * @param string $activityname 73 * @param TableNode $entrydata 74 */ 75 public function i_add_an_entry_to_database_with($activityname, TableNode $entrydata) { 76 77 $this->execute("behat_general::click_link", $this->escape($activityname)); 78 $this->execute("behat_general::click_link", get_string('add', 'mod_data')); 79 80 $this->execute("behat_forms::i_set_the_following_fields_to_these_values", $entrydata); 81 } 82 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |