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

PHPUnit util.php fails with @runTestsInSeparateProcesses

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-80591_401
    • MDL-80591_403
    • Hide

      Requirements

      1. The test must be performed for all the branches patched.
      2. In a Moodle site with this patch applied (integration.git), with the database configured.
      3. Ensure that there isn't any phpunit.xml file in the directory by running from moodleroot: find . -name phpunit.xml | xargs rm
      4. Run: find . -name phpunit.xml
      5. Verify that there is not any file listed.
      6. Run: php admin/tool/phpunit/cli/util.php --install && echo good || echo err
      7. Verify that you get the database installed and the process ends with "good".
      8. Run: php admin/tool/phpunit/cli/util.php --buildconfig && echo good || echo err
      9. Verify that the process ends with "good".
      10. Verify that the phpunit.xml has been created in moodleroot dir.

      PHPUnit (run) testing

      Here we are going to verify that the util.php --run command is able to run any test.

      1. Run: php admin/tool/phpunit/cli/util.php --run h5p/tests/h5p_core_test.php
        • Verify you don't see the fatal error reported on the description:

          PHPUnit\Framework\Exception: PHP Fatal error:  Uncaught Error: Class "PHPUnit\TextUI\XmlConfiguration\Loader" not found in Standard input code:97
          Stack trace:
          #0 {main}
            thrown in Standard input code on line 97
          Fatal error: Uncaught Error: Class "PHPUnit\TextUI\XmlConfiguration\Loader" not found in Standard input code:97
          Stack trace:
          #0 {main}
            thrown in Standard input code on line 97
          

        • Please note: that there are some existing errors when running this test, they are unrelated see MDL-80653
      2. Run: php admin/tool/phpunit/cli/util.php --run --filter mod_label
      3. Verify that the test ends "OK".
      4. Run: php admin/tool/phpunit/cli/util.php --run --testsuite mod_label_testsuite
      5. Verify that the test ends "OK".

      Regression testing

      Here we are going to verify that all the util.php commands continue working as expected.

      1. Run: php admin/tool/phpunit/cli/util.php --diag && echo good || echo err
      2. Verify that the process ends with "good".
      3. Run: php admin/tool/phpunit/cli/util.php --drop && echo good || echo err
      4. Verify that tables are dropped (long list of dots).
      5. Verify that the process ends with "good".
      6. Run: php admin/tool/phpunit/cli/util.php --diag && echo good || echo err
      7. Verify that the process ends with "err" and the message "Moodle PHPUnit environment is not initialised".
      8. Run: find . -name phpunit.xml
      9. Verify that there is only one file found (in moodleroot directory).
      10. Run: php admin/tool/phpunit/cli/util.php --buildcomponentconfigs && echo good || echo err
      11. Verify that the process ends with "good".
      12. Run: find . -name phpunit.xml
      13. Verify that there lots of files found (spread over a lot of directories).
      Show
      Requirements The test must be performed for all the branches patched. In a Moodle site with this patch applied (integration.git), with the database configured. Ensure that there isn't any phpunit.xml file in the directory by running from moodleroot: find . -name phpunit.xml | xargs rm Run: find . -name phpunit.xml Verify that there is not any file listed. Run: php admin/tool/phpunit/cli/util.php --install && echo good || echo err Verify that you get the database installed and the process ends with "good". Run: php admin/tool/phpunit/cli/util.php --buildconfig && echo good || echo err Verify that the process ends with "good". Verify that the phpunit.xml has been created in moodleroot dir. PHPUnit (run) testing Here we are going to verify that the util.php --run command is able to run any test. Run: php admin/tool/phpunit/cli/util.php --run h5p/tests/h5p_core_test.php Verify you don't see the fatal error reported on the description: PHPUnit\Framework\Exception: PHP Fatal error: Uncaught Error: Class "PHPUnit\TextUI\XmlConfiguration\Loader" not found in Standard input code:97 Stack trace: #0 {main} thrown in Standard input code on line 97 Fatal error: Uncaught Error: Class "PHPUnit\TextUI\XmlConfiguration\Loader" not found in Standard input code:97 Stack trace: #0 {main} thrown in Standard input code on line 97 Please note: that there are some existing errors when running this test, they are unrelated see MDL-80653 Run: php admin/tool/phpunit/cli/util.php --run --filter mod_label Verify that the test ends "OK". Run: php admin/tool/phpunit/cli/util.php --run --testsuite mod_label_testsuite Verify that the test ends "OK". Regression testing Here we are going to verify that all the util.php commands continue working as expected. Run: php admin/tool/phpunit/cli/util.php --diag && echo good || echo err Verify that the process ends with "good". Run: php admin/tool/phpunit/cli/util.php --drop && echo good || echo err Verify that tables are dropped (long list of dots). Verify that the process ends with "good". Run: php admin/tool/phpunit/cli/util.php --diag && echo good || echo err Verify that the process ends with "err" and the message "Moodle PHPUnit environment is not initialised". Run: find . -name phpunit.xml Verify that there is only one file found (in moodleroot directory). Run: php admin/tool/phpunit/cli/util.php --buildcomponentconfigs && echo good || echo err Verify that the process ends with "good". Run: find . -name phpunit.xml Verify that there lots of files found (spread over a lot of directories).

      If the @runTestsInSeparateProcesses directive is set in a unit test file and the tests are launched using admin/tool/phpunit/cli/util.php --run, they fail with the following error:

      Fatal error: Uncaught Error: Class "PHPUnit\TextUI\XmlConfiguration\Loader" not found in Standard input code on line 97

      Error: Class "PHPUnit\TextUI\XmlConfiguration\Loader" not found in Standard input code on line 97

      Call Stack:
          0.0010     414296   1. {main}() Standard input code:0

       

      The tests run fine using vendor/bin/phpunit directly.

            stronk7 Eloy Lafuente (stronk7)
            philippimhof Philipp Imhof
            Philipp Imhof Philipp Imhof
            Simey Lameze Simey Lameze
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 days, 4 hours, 12 minutes
                3d 4h 12m

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