WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 21 months ago

#39998 closed enhancement (fixed)

Remove unneeded use of wpdb_exposed_methods_for_testing

Reported by: clarinetlord Owned by: SergeyBiryukov
Milestone: 5.5 Priority: normal
Severity: normal Version: 4.8
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description

In looking at the method test_utf8mb3_post_saves_with_emoji() in the file tests/phpunit/tests/post.php, I noticed an instantiation of the wpdb_exposed_methods_for_testing class. However, it doesn't seem like this test calls any non-public methods of the wpdb class. It seems like using this special class isn't necessary. Am I missing something?

Attachments (1)

Removed_unnecessary_use_of_wpdb_exposed_methods_for_testing_class.patch (681 bytes) - added by clarinetlord 5 years ago.

Download all attachments as: .zip

Change History (6)

#1 @clarinetlord
5 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
22 months ago

  • Milestone changed from Awaiting Review to 5.5
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

Hi there, welcome to WordPress Trac!

Thanks for the ticket, sorry it took so long for someone to get back to you.

Just noting the test was introduced in [30346]. In my testing, the usage of wpdb_exposed_methods_for_testing does seem unnecessary here, the test passes with $wpdb too.

Last edited 22 months ago by SergeyBiryukov (previous) (diff)

#3 follow-up: @clarinetlord
22 months ago

No problem, @SergeyBiryukov. I realize cleaning up a test isn't a very high priority, especially with all the activty surrounding the 5.0 release. I was working on running the core tests through a PDO/SQLite replacement for wpdb, and this was one of the few tests outside of the wpdb tests themselves that was falling. Another one was #40037. It would be great if at some point in the future WP had a true database abstraction layer that used PDO internally that could support several different SQL variants. How much community interest do you think there would be for that feature?

#4 in reply to: ↑ 3 @SergeyBiryukov
21 months ago

Replying to clarinetlord:

It would be great if at some point in the future WP had a true database abstraction layer that used PDO internally that could support several different SQL variants. How much community interest do you think there would be for that feature?

There were some previous discussions in #16091 and #21663. I think creating a new ticket would be the way to get a better idea of the current interest.

#5 @SergeyBiryukov
21 months ago

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

In 47431:

Tests: Remove unnecessary use of wpdb_exposed_methods_for_testing in test_utf8mb3_post_saves_with_emoji().

Props clarinetlord.
Fixes #39998.

Note: See TracTickets for help on using tickets.