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

Allow rerun command to work with namespaced tests

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.3, 3.5, 3.6
    • Fix Version/s: 3.4.4, 3.5.1
    • Component/s: Unit tests
    • Labels:
    • Testing Instructions:
      Hide

      To verify both under linux and windows, for 34, 35 and master:

      1. Copy the attached file - mdl_62577_test.php - into mod/quiz/tests
      2. Run vendor/bin/phpunit -c mod/quiz --filter=mdl (will fail)
      3. Confirm that you get this rerun command: vendor/bin/phpunit -c mod/quiz "tests\mod_quiz\mdl_62577_testcase" mod/quiz/tests/mdl_62577_test.php
      4. Copy and paste this into the console and confirm that it reruns the unit test as expected (which still fails)
      Show
      To verify both under linux and windows, for 34, 35 and master: Copy the attached file - mdl_62577_test.php - into mod/quiz/tests Run vendor/bin/phpunit -c mod/quiz --filter=mdl (will fail) Confirm that you get this rerun command: vendor/bin/phpunit -c mod/quiz "tests\mod_quiz\mdl_62577_testcase" mod/quiz/tests/mdl_62577_test.php Copy and paste this into the console and confirm that it reruns the unit test as expected (which still fails)
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Pull Master Branch:

      Description

      When a unit test fails, we get a message like the following:

      To re-run:
      vendor/bin/phpunit repository_flickr_privacy_testcase repository/flickr/tests/privacy_test.php

      where the command can be copied and pasted into the command line and run.

      If the testcase is namespaced, this doesn't work as the backslashes have to be manually escaped:

      To re-run:
      vendor/bin/phpunit \repository_flickr\privacy_testcase repository/flickr/tests/privacy_test.php

      It would be good if the class name were quoted to allow the command to work as-is.

      (I'm not sure how much of this is valid on Windows, but it's certainly the case on Linux.)

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Jul/18