Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-75626

Some recent change in AM/PM handling is causing Mac tests to fail

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.11.9, 4.0.3
    • None
    • Unit tests
    • MOODLE_311_STABLE, MOODLE_400_STABLE

    Description

      This was detected while testing MDL-75111, with some unit tests failing consistently with Macs (that have different am/pm OS handling, always lowercase, if I'm not wrong).

      So, right now (verified both with 400_STABLE and master, maybe applies to older branches), this test is failing with Macs:

      (MOODLE_400_STABLE %=)$ vendor/bin/phpunit --filter date_legacy_test
      Moodle 4.0.3+ (Build: 20220826), cd11b40558a83e2ac6451c38db56c1349d7adb2b
      Php: 7.4.30, mysqli: 8.0.29, OS: Darwin 21.6.0 x86_64
      PHPUnit 9.5.13 by Sebastian Bergmann and contributors.
       
      .....F..                                                            8 / 8 (100%)
       
      Time: 00:01.208, Memory: 308.00 MB
       
      There was 1 failure:
       
      1) core_date_legacy_testcase::test_userdate
      Failed asserting that two strings are identical.
      --- Expected
      +++ Actual
      @@ @@
      -'Monday, 01 February 1999, 08:40 am'
      +'Monday, 01 February 1999, 08:40 AM'
       
      /Users/stronk7/git_moodle/moodle/lib/tests/date_legacy_test.php:290
      /Users/stronk7/git_moodle/moodle/lib/phpunit/classes/advanced_testcase.php:80
      

      And it was not failing few months ago, when v4.0.0 was released:

      (v4.0.0) %)$ vendor/bin/phpunit --filter date_legacy_test
      Moodle 4.0 (Build: 20220419), 8b359ad7a63cf219110bca80552fe3d4ea2a635d
      Php: 7.4.30, mysqli: 8.0.29, OS: Darwin 21.6.0 x86_64
      PHPUnit 9.5.13 by Sebastian Bergmann and contributors.
       
      ........                                                            8 / 8 (100%)
       
      Time: 00:01.182, Memory: 309.00 MB
       
      OK (8 tests, 513 assertions)
      

      So, obviously, something has changed between v4.0.0 and now (and it's not the test, I've checked that and has not changes since 2015).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              stronk7 Eloy Lafuente (stronk7)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: