Moodle
  1. Moodle
  2. MDL-37779 unit test fixing META
  3. MDL-38364

admin/tool/phpunit/cli/init.php fails with latest PHPUnit

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.6, 2.4.1, 2.5
    • Fix Version/s: 2.3.7, 2.4.4
    • Component/s: Unit tests
    • Labels:
      None
    • Rank:
      48256

      Description

      The admin/tool/phpunit/cli/init.php script errors out with the latest PHPUnit, as PHPUnit does not expect to be have it's autoload.php required by anything but vendor/bin/phpunit in a composer installation. As far as I can tell, the constant PHPUNIT_COMPOSER_INSTALL should be defined before requiring PHPUnit/Autoload.php if the user is in fact running a composer install. The bin/phpunit script does that here

      I don't know what the patch submission process is yet, but defining that constant in [this block|
      https://github.com/moodle/moodle/blob/master/admin/tool/phpunit/cli/util.php#L51] should do it.

      See also: https://github.com/sebastianbergmann/phpunit/issues/848

        Issue Links

          Activity

          Hide
          Stephen Sugden added a comment -

          Just to be clear, the instructions for setting up PHPUnit to run moodle tests no longer work because of this.

          Show
          Stephen Sugden added a comment - Just to be clear, the instructions for setting up PHPUnit to run moodle tests no longer work because of this.
          Hide
          David Monllaó added a comment -

          Assigning to Petr as phpunit integration maintainer

          Show
          David Monllaó added a comment - Assigning to Petr as phpunit integration maintainer
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated (23, 24 & master), thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated (23, 24 & master), thanks!
          Hide
          David Monllaó added a comment - - edited

          It fails when you don't have the phpunit PEAR package installed as Damyon find out.

          Attaching patch on top of integration for 24, it can be cherry-picked to 23 and master
          git pull git://github.com/dmonllao/moodle.git MDL-38364_24-fix-capital-letter-autoload

          Show
          David Monllaó added a comment - - edited It fails when you don't have the phpunit PEAR package installed as Damyon find out. Attaching patch on top of integration for 24, it can be cherry-picked to 23 and master git pull git://github.com/dmonllao/moodle.git MDL-38364 _24-fix-capital-letter-autoload
          Hide
          David Monllaó added a comment -

          Editing testing instructions, with MDL-38524 also integrated

          Show
          David Monllaó added a comment - Editing testing instructions, with MDL-38524 also integrated
          Hide
          Damyon Wiese added a comment -

          Thanks David I have cherrypicked the fix to 23, 24 and master branches.

          Show
          Damyon Wiese added a comment - Thanks David I have cherrypicked the fix to 23, 24 and master branches.
          Hide
          David Monllaó added a comment -

          It passes. I've removed my phpunit pear packages and I've been running the composer installer and the tests in both master and 24. Latest version of phpunit 3.7.18 installed in both branches

          Show
          David Monllaó added a comment - It passes. I've removed my phpunit pear packages and I've been running the composer installer and the tests in both master and 24. Latest version of phpunit 3.7.18 installed in both branches
          Hide
          Petr Škoda added a comment -

          Sorry for the autoload case typo, thanks for discovering it and fixing!

          Show
          Petr Škoda added a comment - Sorry for the autoload case typo, thanks for discovering it and fixing!
          Hide
          Damyon Wiese added a comment -

          This issue has been integrated upstream and is now available via git (and in some hours, via mirrors and downloads).

          Thanks for your contributions!

          Show
          Damyon Wiese added a comment - This issue has been integrated upstream and is now available via git (and in some hours, via mirrors and downloads). Thanks for your contributions!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: