X7ROOT File Manager
Current Path:
/home/cbholdings/pasukulu/mod/choice/tests/behat
home
/
cbholdings
/
pasukulu
/
mod
/
choice
/
tests
/
behat
/
π
..
π
activity_info_completion_automatic.feature
(2.86 KB)
π
activity_info_completion_manual.feature
(4.08 KB)
π
add_choice.feature
(1.17 KB)
π
allow_preview.feature
(2 KB)
π
behat_mod_choice.php
(3.22 KB)
π
block_editing.feature
(4.71 KB)
π
change_response.feature
(2.34 KB)
π
choice_availability.feature
(4.49 KB)
π
choice_no_calendar_capabilities.feature
(2.05 KB)
π
group_mode.feature
(3.07 KB)
π
include_inactive.feature
(5.7 KB)
π
limit_responses.feature
(2.54 KB)
π
modify_choice.feature
(5.85 KB)
π
multiple_options.feature
(3.93 KB)
π
my_home.feature
(2.16 KB)
π
publish_info.feature
(6.03 KB)
π
publish_results.feature
(5.13 KB)
π
publish_results_anonymously.feature
(2.86 KB)
π
remove_choice_options.feature
(1.94 KB)
Editing: behat_mod_choice.php
<?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 for choice activity. * * @package mod_choice * @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'); /** * Choice activity definitions. * * @package mod_choice * @category test * @copyright 2013 David MonllaΓ³ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class behat_mod_choice extends behat_base { /** * Chooses the specified option from the choice activity named as specified. You should be located in the activity's course page. * * @Given /^I choose "(?P<option_string>(?:[^"]|\\")*)" from "(?P<choice_activity_string>(?:[^"]|\\")*)" choice activity$/ * @param string $option * @param string $choiceactivity * @return array */ public function I_choose_option_from_activity($option, $choiceactivity) { $this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($choiceactivity), 'choice activity']); $this->execute('behat_forms::i_set_the_field_to', array( $this->escape($option), 1)); $this->execute("behat_forms::press_button", get_string('savemychoice', 'choice')); } /** * Chooses the specified option from the choice activity named as specified and save the choice. * You should be located in the activity's course page. * * @Given /^I choose options (?P<option_string>"(?:[^"]|\\")*"(?:,"(?:[^"]|\\")*")*) from "(?P<choice_activity_string>(?:[^"]|\\")*)" choice activity$/ * @param string $option * @param string $choiceactivity * @return array */ public function I_choose_options_from_activity($option, $choiceactivity) { // Get Behat general and forms contexts. $behatgeneral = behat_context_helper::get('behat_general'); $behatforms = behat_context_helper::get('behat_forms'); // Go to choice activity. $this->execute("behat_navigation::i_am_on_page_instance", [$this->escape($choiceactivity), 'choice activity']); // Wait for page to be loaded. $this->wait_for_pending_js(); // Set all options. $options = explode('","', trim($option, '"')); foreach ($options as $option) { $behatforms->i_set_the_field_to($this->escape($option), '1'); } // Save choice. $behatforms->press_button(get_string('savemychoice', 'choice')); } }
Upload File
Create Folder