Merge branch 'MDL-42338' of git://github.com/rwijaya/moodle
[moodle.git] / calendar / tests / behat / behat_calendar.php
blob01dc79bfb337894559627bd1b76ae6201bcf88e7
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.
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/>.
17 /**
18 * Behat calendar-related steps definitions.
20 * @package core_calendar
21 * @category test
22 * @copyright 2013 Mark Nelson <markn@moodle.com>
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 // NOTE: no MOODLE_INTERNAL used, this file may be required by behat before including /config.php.
27 require_once(__DIR__ . '/../../../lib/behat/behat_base.php');
29 use Behat\Behat\Context\Step\Given as Given;
30 use Behat\Gherkin\Node\TableNode as TableNode;
32 /**
33 * Contains functions used by behat to test functionality.
35 * @package core_calendar
36 * @category test
37 * @copyright 2013 Mark Nelson <markn@moodle.com>
38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
40 class behat_calendar extends behat_base {
42 /**
43 * Create event.
45 * @Given /^I create a calendar event with form data:$/
46 * @param TableNode $data
47 * @return array the list of actions to perform
49 public function i_create_a_calendar_event_with_form_data($data) {
50 // Get the event name.
51 $eventname = $data->getRow(1);
52 $eventname = $eventname[1];
54 return array(
55 new Given('I follow "' . get_string('monththis', 'calendar') . '"'),
56 new Given('I click on "' . get_string('newevent', 'calendar') .'" "button"'),
57 new Given('I fill the moodle form with:', $data),
58 new Given('I press "' . get_string('savechanges') . '"'),
59 new Given('I should see "' . $eventname . '"')