From 400227c0f4d5bffca91aac273f38f7b8cb2c0440 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 11 Mar 2024 12:09:27 +0000 Subject: [PATCH] MDL-73117 calendar: restore previously removed Behat step definition. --- .../tests/behat/behat_calendar_deprecated.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/calendar/tests/behat/behat_calendar_deprecated.php b/calendar/tests/behat/behat_calendar_deprecated.php index a563eae8a06..0fc1a08838b 100644 --- a/calendar/tests/behat/behat_calendar_deprecated.php +++ b/calendar/tests/behat/behat_calendar_deprecated.php @@ -42,7 +42,18 @@ class behat_calendar_deprecated extends behat_deprecated_base { public function i_hover_over_today_in_the_calendar() { $this->deprecated_message('behat_calendar::i_hover_over_today_in_the_calendar'); $todaysday = date('j'); - // Note: This step was removed via MDL-71733 but this step was not deprecated alongside it. - return $this->i_hover_over_day_of_this_month_in_calendar($todaysday); + + $summarytitle = userdate(time(), get_string('strftimemonthyear')); + // The current month table. + $currentmonth = "table[descendant::*[self::caption[contains(concat(' ', normalize-space(.), ' '), ' {$summarytitle} ')]]]"; + + // Strings for the class cell match. + $cellclasses = "contains(concat(' ', normalize-space(@class), ' '), ' day ')"; + $daycontains = "text()[contains(concat(' ', normalize-space(.), ' '), ' {$todaysday} ')]"; + $daycell = "td[{$cellclasses}]"; + $dayofmonth = "a[{$daycontains}]"; + + $xpath = '//' . $currentmonth . '/descendant::' . $daycell . '/' . $dayofmonth; + $this->execute("behat_general::i_hover", [$xpath, "xpath_element"]); } }