Skip to:

Opened 6 years ago

Closed 6 years ago

#2883 closed defect (fixed)

Fix failing unit tests

Reported by: thebrandonallen Owned by: netweb
Milestone: 2.6 Priority: normal
Severity: normal Version: trunk
Component: Tools - Unit Tests Keywords: has-patch


We have a number of failing unit tests. The attached patch, makes them happy.

  • [WP34172] sets $_SERVER[ 'REMOTE_ADDR' ] to, which is overriding our setting of $_SERVER[ 'REMOTE_ADDR' ] = ''. I've updated our setting and updated tests to match.
  • [WP34802], [WP34803], [WP34807], and [WP34810] introduce set_permalink_structure. It's implementation breaks ours, and is also more robust. I've updated our version to be compatible with tests on trunk/4.4+. I've also made moved our set_permalinks_method() to the main BBP_UnitTestCase class.
  • Update two tests to use WP's assertEqualSets() when comparing arrays that may not be in the same order. We should probably update our other tests, and then use this method going forward. For now, this fixes the failing tests.

Attachments (2)

2883.01.patch (16.3 KB) - added by thebrandonallen 6 years ago.
2883.02.patch (27.0 KB) - added by thebrandonallen 6 years ago.

Download all attachments as: .zip

Change History (6)

#1 @thebrandonallen
6 years ago

[WP35244] improves WP_UnitTest_Generator_Sequence to be a static generator. This is nice, but it significantly effects our tests. Updated patch to explicitly set content and titles when we are running tests that depend on this content.

#2 @netweb
6 years ago

In 5941:

Tests: Use assertEqualSets() in:

  • BBP_Tests_Forums_Functions_Query::test_bbp_forum_query_topic_ids
  • BBP_Tests_Forums_Functions_Query::test_bbp_forum_query_subforum_ids

This changeset improves array comparisons where that arrays may not be in the same order.

Props thebrandonallen. See #2883

#3 @netweb
6 years ago

In 5946:

Users: Update $_SERVER['REMOTE_ADDR'] IP adress check to in bbp_current_author_ip()

This changeset updates our unit tests and ensures compatability with WordPress test suite where in [WP34172] $_SERVER[ 'REMOTE_ADDR' ] is now initialised during the test bootstrap so individual tests need not.

Props thebrandonallen. See #2883.

#4 @netweb
6 years ago

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

In 5947:

Tests: Updated bbPress PHPUnit test suite compatibility with upstream WordPress changes.

  • [WP35244] WP_UnitTest_Generator_Sequence needs a static incrementer - otherwise, it assumes every test class is a reset, which it no longer is (it is now static), updated bbPress unit tests where explicitly set content and titles are required.

Props thebrandonallen. Fixes #2883

Note: See TracTickets for help on using tickets.