Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#42232 closed defect (bug) (fixed)

AJAX test failures with PHPUnit 6.4.2

Reported by: SergeyBiryukov Owned by: pento
Priority: normal Milestone: 4.9
Component: Build/Test Tools Version:
Severity: normal Keywords: fixed-major
Cc: Focuses:

Description

It looks like Travis has switched to PHPUnit 6.4.2, which caused two AJAX test failures:

There were 2 failures:
1) Tests_Ajax_CompressionTest::test_logged_out
Failed asserting that exception message '-1' contains '0'.
2) Tests_Ajax_TagSearch::test_no_results
Failed asserting that exception message '' contains '0'.

Traced this to a recent change in TestCase::runTest().

In 6.4.1 and earlier versions, $this->setExpectedException( 'WPAjaxDieStopException', '0' ) didn't work as expected due to a !empty($this->expectedExceptionMessage) check, the $message argument was just ignored.

Now these assertions have actually started working and should be adjusted to make sure we expect correct results.

Change History (9)

#1 @SergeyBiryukov
9 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 41870:

Build/Test Tools: Pass correct $message argument to WP_UnitTestCase::setExpectedException() in Tests_Ajax_CompressionTest::test_logged_out() and Tests_Ajax_TagSearch::test_no_results().

PHPUnit 6.4.1 and earlier versions ignored the '0' value, causing the issue to go unnoticed.

Fixes #42232.

This ticket was mentioned in Slack in #core by sergey. View the logs.


9 years ago

#3 @pento
9 years ago

  • Keywords fixed-major added
  • Resolution fixed
  • Status closedreopened

This bug causes failures back to the 4.4 branch, so needs to be back ported. No-one likes random failures while back porting fixes.

#4 @pento
9 years ago

  • Owner changed from SergeyBiryukov to pento
  • Status reopenedassigned

#5 @pento
9 years ago

In 42051:

Build/Test Tools: Pass correct $message argument to WP_UnitTestCase::setExpectedException() in Tests_Ajax_CompressionTest::test_logged_out() and Tests_Ajax_TagSearch::test_no_results().

PHPUnit 6.4.1 and earlier versions ignored the '0' value, causing the issue to go unnoticed.

Merge of [41870] to the 4.8 branch.

Props SergeyBiryukov.
See #42232.

#6 @pento
9 years ago

In 42052:

Build/Test Tools: Pass correct $message argument to WP_UnitTestCase::setExpectedException() in Tests_Ajax_CompressionTest::test_logged_out() and Tests_Ajax_TagSearch::test_no_results().

PHPUnit 6.4.1 and earlier versions ignored the '0' value, causing the issue to go unnoticed.

Merge of [41870] to the 4.7 branch.

Props SergeyBiryukov.
See #42232.

#7 @pento
9 years ago

In 42053:

Build/Test Tools: Pass correct $message argument to WP_UnitTestCase::setExpectedException() in Tests_Ajax_CompressionTest::test_logged_out() and Tests_Ajax_TagSearch::test_no_results().

PHPUnit 6.4.1 and earlier versions ignored the '0' value, causing the issue to go unnoticed.

Merge of [41870] to the 4.6 branch.

Props SergeyBiryukov.
See #42232.

#8 @pento
9 years ago

In 42054:

Build/Test Tools: Pass correct $message argument to WP_UnitTestCase::setExpectedException() in Tests_Ajax_CompressionTest::test_logged_out() and Tests_Ajax_TagSearch::test_no_results().

PHPUnit 6.4.1 and earlier versions ignored the '0' value, causing the issue to go unnoticed.

Merge of [41870] to the 4.5 branch.

Props SergeyBiryukov.
See #42232.

#9 @pento
9 years ago

  • Resolutionfixed
  • Status assignedclosed

In 42055:

Build/Test Tools: Pass correct $message argument to WP_UnitTestCase::setExpectedException() in Tests_Ajax_CompressionTest::test_logged_out() and Tests_Ajax_TagSearch::test_no_results().

PHPUnit 6.4.1 and earlier versions ignored the '0' value, causing the issue to go unnoticed.

Merge of [41870] to the 4.4 branch.

Props SergeyBiryukov.
Fixes #42232.

Note: See TracTickets for help on using tickets.