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 * Behat steps definitions for the select missing words question type. 19 * 20 * @package qtype_gapselect 21 * @category test 22 * @copyright 2015 The Open University 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 /** 31 * Steps definitions related with for the select missing words question type. 32 * 33 * @copyright 2015 The Open University 34 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 35 */ 36 class behat_qtype_gapselect extends behat_base { 37 38 /** 39 * Get the xpath for a given missing word. 40 * @param string $spacenumber the number of select menu. 41 * @return string the xpath expression. 42 */ 43 protected function space_xpath($spacenumber) { 44 $class = 'place' . $spacenumber; 45 return "//select[contains(@class, ' $class')]"; 46 } 47 48 /** 49 * Drag the drag item with the given text to the given space. 50 * 51 * @param int $spacenumber the number of the gap to drop into. 52 * @param string $value the text of the response to select. 53 * 54 * @Given /^I set space "(?P<space_number>\d+)" to "(?P<value>[^"]*)" in the select missing words question$/ 55 */ 56 public function i_set_space_to_in_the_select_missing_words_question($spacenumber, $value) { 57 $formscontext = behat_context_helper::get('behat_forms'); 58 $formscontext->i_set_the_field_with_xpath_to($this->space_xpath($spacenumber), $value); 59 } 60 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body