Moodle
  1. Moodle
  2. MDL-34484

Strange name collision in unit tests.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor 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:
    • Rank:
      42901

      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.

        Activity

        Hide
        Petr Škoda added a comment -

        +1

        Show
        Petr Škoda added a comment - +1
        Hide
        Dan Poltawski added a comment -

        Pulling this easy one into this weeks integration.

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

        Integrated that, thanks Tim.

        Show
        Dan Poltawski added a comment - Integrated that, thanks Tim.
        Hide
        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
        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
        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
        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: