MDL-67598 unit tests: Pass day of month without leading zero
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 1 Jan 2020 23:06:40 +0000 (00:06 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 1 Jan 2020 23:06:40 +0000 (00:06 +0100)
Note this fixes the unit tests. Still the calendar API itself
should be able to manage this cases, both casting (int) or
being stricter about what's allowed there (param hinting).

But that falls out from this issue and the code that introduced
the failures, so the pure unit-test fix has been applied.

calendar/tests/externallib_test.php

index acf2294..fc5ea7e 100644 (file)
@@ -2372,7 +2372,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
         $data = external_api::clean_returnvalue(
             core_calendar_external::get_calendar_monthly_view_returns(),
             core_calendar_external::get_calendar_monthly_view($timestart->format('Y'), $timestart->format('n'),
-                                                              $course->id, null, false, true, $timestart->format('d'))
+                                                              $course->id, null, false, true, $timestart->format('j'))
         );
         $this->assertEquals($data['courseid'], $course->id);
         // User enrolled in the course can load the course calendar.
@@ -2380,7 +2380,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
         $data = external_api::clean_returnvalue(
             core_calendar_external::get_calendar_monthly_view_returns(),
             core_calendar_external::get_calendar_monthly_view($timestart->format('Y'), $timestart->format('n'),
-                                                              $course->id, null, false, true, $timestart->format('d'))
+                                                              $course->id, null, false, true, $timestart->format('j'))
         );
         $this->assertEquals($data['courseid'], $course->id);
         // User not enrolled in the course cannot load the course calendar.
@@ -2389,7 +2389,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
         $data = external_api::clean_returnvalue(
             core_calendar_external::get_calendar_monthly_view_returns(),
             core_calendar_external::get_calendar_monthly_view($timestart->format('Y'), $timestart->format('n'),
-                                                              $course->id, null, false, false, $timestart->format('d'))
+                                                              $course->id, null, false, false, $timestart->format('j'))
         );
     }
 
@@ -2404,7 +2404,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
         $data = external_api::clean_returnvalue(
             core_calendar_external::get_calendar_monthly_view_returns(),
             core_calendar_external::get_calendar_monthly_view($timestart->format('Y'), $timestart->format('n'),
-                                                              SITEID, null, false, true, $timestart->format('d'))
+                                                              SITEID, null, false, true, $timestart->format('j'))
         );
         $this->assertEquals($data['date']['mday'], $timestart->format('d'));
     }