Uploaded image for project: 'Moodle Community Sites'
  1. Moodle Community Sites
  2. MDLSITE-2824

Adding PHPUnit tags to valid and allowed whitelists

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Low Low
    • Coding style
    • None

      See http://phpunit.de/manual/3.7/en/appendixes.annotations.html#appendixes.annotations.group

      I am trying to get my PHPUnit tests to pass the Moodle coding style checker, but it doesn't like some of the tags I use. The main PHPUnit tags I use are:

      dataProvider // Useful for writing tests with a large set of data that can be programmatically generated.
      group // If is even recommended in http://docs.moodle.org/dev/PHPUnit#Using_the_.40group_annotation
      depends // Useful to ignore certain unit tests if a certain other one fails.
      expectedException, expectedExceptionCode, expectedExceptionMessage // Useful for check that exceptions on error conditions occur rather than doing a try/catch (shorter code).
      I haven't used "long" yet, but in the Moodle PHPUnit docs there is a section about long tests. Maybe if we can tag certain tests as being long, we can exclude them during the group filter: http://docs.moodle.org/dev/Writing_PHPUnit_tests#Long_tests

      Also, I noticed that a lot of Moodle core unit tests have "@category phpunit", but that is an invalid category according to this checker. Should that be changed? Or core code changed to use "test" as a valid category?

            stronk7 Eloy Lafuente (stronk7)
            rex Rex Lorenzo
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

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