Make WordPress Core

#50377 closed defect (bug) (fixed)

phpunit tests fail with - Failed opening required class-phpmailer.php (2)

Reported by: bwmarkle Owned by:
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.5
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:


This is a follow-up to #49377.

I made that ticket because of this error:

PHP Fatal error:
        Failed opening required '/tmp/wordpress-tests-lib/src//wp-includes/class-phpmailer.php'
        in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2

4 months later, it looks like another similar error is happening:

Fatal error:
        Failed opening required '/tmp/wordpress//wp-includes/PHPMailer/PHPMailer.php'
        in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2

I resolved this issue in my automated builds by once again reverting to the 5.2 content, which leads me to believe it's a similar issue:

# phpunit tests temporarily changed from "trunk" to "5.2". They should be reverted after a resolution
# is found here: https://core.trac.wordpress.org/ticket/49377#ticket
# svn co --quiet https://develop.svn.wordpress.org/trunk/tests/phpunit/includes/
# wget -nv -O wp-tests-config.php https://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php
svn co --quiet https://develop.svn.wordpress.org/branches/5.2/tests/phpunit/includes/
wget -nv -O wp-tests-config.php https://develop.svn.wordpress.org/branches/5.2/wp-tests-config-sample.php

Any thoughts?

\- Brad

Attachments (1)

50377.diff (600 bytes) - added by desrosj 18 months ago.

Download all attachments as: .zip

Change History (5)

#1 @SergeyBiryukov
18 months ago

  • Milestone changed from Awaiting Review to 5.5

Hi there, welcome back to WordPress Trac!

Thanks for the report. This appears to be related to updating the PHPMailer version in [48033] / #41750.

18 months ago

#2 @desrosj
18 months ago

  • Keywords has-patch added
  • Version set to trunk

Looked into this a bit. ABSPATH includes a trailing /. 50377.diff removes the extra / from the require_once statements in the MockPHPMailer class.

Going to fix that and see if @bwmarkle's issue is resolved from that.

#3 @desrosj
18 months ago

In 48058:

Build/Test Tools: Prevent double /s when including PHPMailer files.

ABSPATH includes a trailing slash already.

Follow up of [48033].
Props desrosj.
See #50377, #41750.

#4 @desrosj
18 months ago

  • Resolution set to fixed
  • Status changed from new to closed

@bwmarkle shared the failing job with me on Slack.

It looks like the problem is with the test install script. The tests are being installed from trunk, regardless of the $WP_VERSION defined. It looks like the version being fetched is latest, which is an alias to the most recent publicly released version (in this case, 5.4.2). This is a problem because the files were moved around in trunk.

To fix the tests, the test branch should either be changed to always be the latest released version (5.4 in this case), or the install script needs to be updated to download the nightly package (which can be found here and is refreshed nightly https://wordpress.org/nightly-builds/wordpress-latest.zip) instead of the latest public release.

For an example, check out the latest install script in the WP-CLI scaffolding command. It is pretty smart about detecting the latest version number and checking out the correct version of the test library.

Because this seems like an issue in the plugin repository, I am going to close this out. But if it still seems like something is wrong on the core side, feel free to reopen with more info.

Note: See TracTickets for help on using tickets.