Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#49377 closed defect (bug) (fixed)

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

Reported by: bwmarkle's profile bwmarkle Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.4 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: Cc:


This ticket is for the phpunit tests found here:

If I am submitting this ticket in the wrong place, please let me know.

Our phpunit tests are failing with the following:

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

When troubleshooting, we found two things:

The path where class-phpmailer.php is trying to be loaded from, /tmp/wordpress-tests-lib/src//wp-includes/class-phpmailer.php is wrong, it should be /tmp/wordpress/wp-includes/class-phpmailer.php

For the tests themselves, when using the 5.2 branch instead of trunk, it works, it seems like something changed recently to cause this.


  • Brad

Change History (2)

#1 @SergeyBiryukov
4 years ago

  • Component changed from General to Build/Test Tools
  • Milestone changed from Awaiting Review to 5.4

Hi there, welcome back to WordPress Trac! Thanks for the report.

Are you using the wp scaffold plugin command? This appears to be the same issue as in comment:15:ticket:48082.

#2 @SergeyBiryukov
4 years ago

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

In 47201:

Tests: Revert the dirname( __FILE__ ) replacement in wp-tests-config-sample.php for now, to avoid breaking unit tests created with WP-CLI scaffold command.

Follow-up to [47198].

Props kaggdesign, danielbachhuber, bwmarkle.
Fixes #48082, #49377.

Note: See TracTickets for help on using tickets.