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

Strange name collision in unit tests.

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.1, 2.4
    • Fix Version/s: 2.3.2, 2.4
    • Component/s: Unit tests
    • Labels:
    • Testing Instructions:
      Hide

      You can reproduce the original problem by installing https://github.com/maths/moodle-qtype_stack and trying to run the unit tests. However, that is probably overkill.

      It is probably sufficient to just run the unit tests in core Moodle, to verify that this does not cause any regressions.

      Show
      You can reproduce the original problem by installing https://github.com/maths/moodle-qtype_stack and trying to run the unit tests. However, that is probably overkill. It is probably sufficient to just run the unit tests in core Moodle, to verify that this does not cause any regressions.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      1. At the moment, the init script generates test-cases like <testsuite name="@component@">. The problem with this is that if your plugin is called qtype_stack, and you have a class called qtype_stack, then sometimes it tries to create an instance of the class to use at the test site. That leads to a fatal error saying that qtype_stack is not an instance of whatever PHPunit class.

      The solution seems to be to change the testcase name to something like <testsuite name="@component@ test case"> which cannot possibly be a PHP class name.

        Gliffy Diagrams

          Activity

          Hide
          skodak Petr Skoda added a comment -

          +1

          Show
          skodak Petr Skoda added a comment - +1
          Hide
          poltawski Dan Poltawski added a comment -

          Pulling this easy one into this weeks integration.

          Show
          poltawski Dan Poltawski added a comment - Pulling this easy one into this weeks integration.
          Hide
          poltawski Dan Poltawski added a comment -

          Integrated that, thanks Tim.

          Show
          poltawski Dan Poltawski added a comment - Integrated that, thanks Tim.
          Hide
          poltawski Dan Poltawski added a comment -

          I had high intentions testing qtype, but I was missing the dependencies for it, so ended up just doing the regression test.

          Which passes!

          Show
          poltawski Dan Poltawski added a comment - I had high intentions testing qtype, but I was missing the dependencies for it, so ended up just doing the regression test. Which passes!
          Hide
          nebgor Aparup Banerjee added a comment -

          yay, it works!

          This issue has been put through rigorous processes and finally swam upstream along with some 65 others this week.

          Thank you all for taking the time to get us here.

          cheers!

          Show
          nebgor Aparup Banerjee added a comment - yay, it works! This issue has been put through rigorous processes and finally swam upstream along with some 65 others this week. Thank you all for taking the time to get us here. cheers!

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Sep/12