Skip to:
Content

bbPress.org

Opened 8 years ago

Closed 8 years ago

Last modified 14 months ago

#3108 closed defect (bug) (fixed)

Fix tests after [6414]

Reported by: thebrandonallen's profile thebrandonallen Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6 Priority: normal
Severity: normal Version: trunk
Component: Tools - Unit Tests Keywords: has-patch commit
Cc:

Description

After [6414] test broke. Fixing the phpunit: trim() expects parameter 1 to be string, array given errors revealed some other surprises.

The performance improvements were drastic enough that tests were failing because of post date collisions. In the places where we create_many() post dates were equal. In most cases this was fine. In places where we're trying to get the last id, this resulted in the wrong id being returned. The queries were being ordered by descending post date, then ascending post id.

Attached patch fixes the trim errors, two assertEquals on arrays, and the post date collisions by setting our last id functions to sort by post date, then by post id, in descending order.

Also included, but not required are changes to test_bbp_get_forum_last_reply_id() which should allow for that test to run a little faster. We were querying for the last reply id when we already knew what to expect.

Attachments (1)

3108.01.diff (4.5 KB) - added by thebrandonallen 8 years ago.

Download all attachments as: .zip

Change History (4)

#1 @johnjamesjacoby
8 years ago

  • Keywords commit added

These all look good to me. 👍

Thanks!

#2 @netweb
8 years ago

In 6423:

Tests: Improve test_bbp_get_forum_last_reply_id() test performance.

No need to query for the last reply ID as we already knew what to expect.t.

See #3108.
Props thebrandonallen.

#3 @johnjamesjacoby
8 years ago

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

In 6434:

Queries: Update orderby clauses of last-id queries to ensure more accurate results, specifically for imported forums and posts where IDs and post_date columns might be inverted.

Also update a few tests to be less cranky with exact array results.

Props thebrandonallen. Fixes #3108.

Note: See TracTickets for help on using tickets.