Make WordPress Core

Opened 8 years ago

Closed 6 years ago

#40532 closed defect (bug) (fixed)

Find a workaround for unit tests that have a dependency on XDebug

Reported by: johnbillion's profile johnbillion Owned by: pento's profile pento
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: needs-patch needs-unit-tests
Focuses: Cc:

Description

In #39978, XDebug was disabled when running the test suite on Travis. This resulted in a 40% increase in build speed and a 40% decrease in developer frustration.

Unfortunately it was overlooked that two tests in core have a dependency on XDebug:

  • Tests_Ajax_Response::test_response_charset_in_header() (ref)
  • Tests_oEmbed_HTTP_Headers::test_rest_pre_serve_request_headers() (ref)

Both of these tests are skipped when XDebug isn't available, so they're no longer tested on Travis.

A workaround needs to be found for these tests so they no longer rely on XDebug.

Change History (5)

#1 @jmichaelward
7 years ago

I spent some time digging around the web for answers to this issue and have come up mostly empty. One question I do have is whether the speed in which tests run in Travis are related to the mere presence of Xdebug, or rather that Xdebug is enabled for the duration of the test process.

Xdebug does have two methods - xdebug_enable and xdebug_disable which, I would think, could be triggered within particular tests that require the xdebug_get_headers method. This would require Xdebug to be included in the Travis PHP ini file, but with the default_enable flag set to false and, I believe, remote_enable set to true. Outside of that, I haven't found a definitive way to get headers while PHP is running in the CLI.

#2 @johnbillion
7 years ago

Thanks for looking into this, @jmichaelward. I believe that the mere presence of Xdebug impacts the performance, but this assumption would benefit from some testing.

#3 @netweb
7 years ago

The other option I'd thought of was to create a new PHPUnit test group, similar to the ajax, ms-files, external-http etc groups specifically for Xdebug, tests that require it are moved into that group and that group only is tested with Xdebug enabled, again, this would need some testing for feasibility.

#4 @pento
6 years ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to pento
  • Status changed from new to accepted

#5 @pento
6 years ago

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

In 45827:

Tests: Add an xdebug group for tests that require xdebug.

These tests are now also run as their own part of the Travis build, to ensure performance of other tests isn't affected by the presence of xdebug.

Fixes #40532.

Note: See TracTickets for help on using tickets.