From 3bc58c98d091694d9bb0873ef782cb420a8a082c Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Fri, 19 Feb 2021 14:02:10 +0800 Subject: [PATCH] MDL-44613 behat: strftime format in time to timestamp transformation Modifies the 'string time to timestamp' behat trasformation to use userdate() instead of date(). The userdate() method is generally used throught Moodle for constructing formatted date strings and this change will provide more consistency and prevent any potential behat failures. Therefore, if the date format is defined in the given trasformation, it has to be strftime compatible. Example: 'I should see "##tomorrow noon##%A, %d %B %Y, %I:%M %p##"' --- lib/tests/behat/behat_transformations.php | 4 ++-- lib/upgrade.txt | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/tests/behat/behat_transformations.php b/lib/tests/behat/behat_transformations.php index 7e4fd490b4c..cd5c4a41221 100644 --- a/lib/tests/behat/behat_transformations.php +++ b/lib/tests/behat/behat_transformations.php @@ -167,8 +167,8 @@ class behat_transformations extends behat_base { $count = count($timepassed); if ($count === 2) { - // If timestamp with spcified format, then retrun date. - return date($timepassed[1], $timestamp); + // If timestamp with specified strftime format, then return formatted date string. + return userdate($timestamp, $timepassed[1]); } else if ($count === 1) { return $timestamp; } else { diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 5b12b8c6816..214b7b246c9 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -48,6 +48,9 @@ information provided here is intended especially for developers. those fields. This replaces existing functions get_extra_user_fields(), get_extra_user_fields_sql(), get_user_field_name(), get_all_user_name_fields(), and user_picture::fields(), which have all been deprecated. +* The behat transformation 'string time to timestamp' no longer supports datetime format. If provided, the format must + be strftime compatible. Example: + - I should see "##tomorrow noon##%A, %d %B %Y, %I:%M %p##" === 3.10 === * PHPUnit has been upgraded to 8.5. That comes with a few changes: