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

PHPUnit failures caused by unix expected dir separators under windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.10
    • 3.10
    • Unit tests

      It has been detected that MDL-68874 introduced some tests dependent of OS directory separators (DIRECTORY_SEPARATOR) and/or end of line chars (PHP_EOL).

      $ vendor/bin/phpunit core_dml_testcase lib/dml/tests/dml_test.php
      Moodle 4.0dev (Build: 20200723), 94fdac9117db2fd0f2d999f0bdd822fab6193e52
      Php: 7.3.5, pgsql: 10.6, OS: Windows NT 10.0 AMD64
      PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
       
      .....F.........................................................  63 / 105 ( 60%)
      ..........................................                      105 / 105 (100%)
       
      Time: 15.81 seconds, Memory: 48.00 MB
       
      There was 1 failure:
       
      1) core_dml_testcase::test_add_sql_debugging
      Failed asserting that two strings are equal.
      --- Expected
      +++ Actual
      @@ @@
       'SELECT * FROM {users}\n
      --- line 65 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke()'
      +-- line 65 of \lib\dml\tests\fixtures\test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke()'
       
      C:\Users\stronk7\git_moodle\integration\lib\dml\tests\dml_test.php:464
      C:\Users\stronk7\git_moodle\integration\lib\phpunit\classes\database_driver_testcase.php:143
       
      To re-run:
       vendor/bin/phpunit "core_dml_testcase" lib/dml/tests/dml_test.php
       
      FAILURES!
      Tests: 105, Assertions: 1208, Failures: 1.
      

      This issue is about to make the tests cross-os, without modifying the codebase because it's assumed to be correct.

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Tim Hunt Tim Hunt
            Andrew Lyons Andrew Lyons
            Shamim Rezaie Shamim Rezaie
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 20 minutes
                2h 20m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.