Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-36920 SQLite support for 3.9+
  3. MDL-36922

PHPUnit assertions take the expected value first

XMLWordPrintable

    • MOODLE_23_STABLE

      I'm just looking at some failing unit tests, and the failures they report are the wrong way round. The message output is :

      Failed asserting that -1 matches expected null.

      When actually, it is -1 that was expected.

      PHPUnit assertions function generally take the expected value, then the actual value in that order. I don't know how widespread this is, and I'm not sure that it's worth the bother of fixing existing tests en masse, but it might be worth keeping an eye on it for future tests, to save people time when debugging failures.

      The file I'm seeing this in is lib/ddl/test/ddl_tests.php and it has maybe a hundred or so examples of this, though it's not consistent so some of the assertEquals are the right way round.

            dobedobedoh Andrew Lyons
            bawjaws David Scotson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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