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 |
require_once(__DIR__ . '/../../../lib/behat/behat_deprecated_base.php');
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
* Steps definitions that are now deprecated and will be removed in the next releases.
|
|
|
23 |
*
|
|
|
24 |
* This file only contains the steps that previously were in the behat_*.php files in the SAME DIRECTORY.
|
|
|
25 |
* When deprecating steps from other components or plugins, create a behat_COMPONENT_deprecated.php
|
|
|
26 |
* file in the same directory where the steps were defined.
|
|
|
27 |
*
|
|
|
28 |
* @package core_calendar
|
|
|
29 |
* @category test
|
|
|
30 |
* @copyright 2024 Mathew May <mathew.solutions>
|
|
|
31 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
32 |
*/
|
|
|
33 |
class behat_calendar_deprecated extends behat_deprecated_base {
|
|
|
34 |
/**
|
|
|
35 |
* Hover over today in the calendar.
|
|
|
36 |
*
|
|
|
37 |
* @Given /^I hover over today in the calendar$/
|
|
|
38 |
*
|
|
|
39 |
* @deprecated since 4.4 MDL-73117.
|
|
|
40 |
* @TODO MDL-79721: This will be deleted in Moodle 4.8.
|
|
|
41 |
*/
|
|
|
42 |
public function i_hover_over_today_in_the_calendar() {
|
|
|
43 |
$this->deprecated_message('behat_calendar::i_hover_over_today_in_the_calendar');
|
|
|
44 |
$todaysday = date('j');
|
|
|
45 |
|
|
|
46 |
$summarytitle = userdate(time(), get_string('strftimemonthyear'));
|
|
|
47 |
// The current month table.
|
|
|
48 |
$currentmonth = "table[descendant::*[self::caption[contains(concat(' ', normalize-space(.), ' '), ' {$summarytitle} ')]]]";
|
|
|
49 |
|
|
|
50 |
// Strings for the class cell match.
|
|
|
51 |
$cellclasses = "contains(concat(' ', normalize-space(@class), ' '), ' day ')";
|
|
|
52 |
$daycontains = "text()[contains(concat(' ', normalize-space(.), ' '), ' {$todaysday} ')]";
|
|
|
53 |
$daycell = "td[{$cellclasses}]";
|
|
|
54 |
$dayofmonth = "a[{$daycontains}]";
|
|
|
55 |
|
|
|
56 |
$xpath = '//' . $currentmonth . '/descendant::' . $daycell . '/' . $dayofmonth;
|
|
|
57 |
$this->execute("behat_general::i_hover", [$xpath, "xpath_element"]);
|
|
|
58 |
}
|
|
|
59 |
}
|