Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#36917 closed task (blessed) (fixed)

Re-architect wpdb::init_charset() for unit testing

Reported by: pento's profile pento Owned by: pento's profile pento
Milestone: 4.6 Priority: normal
Severity: minor Version:
Component: Database Keywords: has-patch needs-unit-tests
Focuses: Cc:


The behaviour of wpdb::init_charset() is becoming more complex, but due to the dependence on defines for passing data, instead of parameters, it's not possible to test that behaviour.

By splitting up the logic, we can add testing for this method.

See [37522].

Attachments (1)

36917.diff (3.1 KB) - added by pento 8 years ago.

Download all attachments as: .zip

Change History (4)

8 years ago

#1 @pento
8 years ago

  • Keywords has-patch needs-unit-tests added
  • Milestone changed from Future Release to 4.6

First pass.

#2 @pento
8 years ago

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

In 37601:

Database: Split the logic of wpdb::init_charset() into a separate method.

The logic for determining the appropriate character set and collation to use is becoming more complex, particularly with the recent additions of [37522] and [37523]. As init_charset() has side effects, and makes use of constants instead of parameters, it's not possible to unit test this logic.

This commit splits the logic part of init_charset() out into a new method, wpdb::determine_charset(), along with appropriate unit tests.

See #32105, #37522.

Fixes #36917.

#3 @pento
8 years ago

In 37602:

Tests: Fix an incorrect @ticket header introduced in [37601].

See #32405, #36917.

Note: See TracTickets for help on using tickets.