WordPress.org

Make WordPress Core

Opened 5 weeks ago

Last modified 5 weeks ago

#53987 new enhancement

add tests for wp_list_filter

Reported by: pbearne Owned by:
Milestone: 5.9 Priority: normal
Severity: normal Version: trunk
Component: Build/Test Tools Keywords: has-patch has-unit-tests
Focuses: Cc:

Description


Change History (11)

This ticket was mentioned in PR #1614 on WordPress/wordpress-develop by pbearne.


5 weeks ago

  • Keywords has-patch has-unit-tests added

wpListeFilter.php claimed to test wp_list_filter but had no tests for it so I have added them

Trac ticket: https://core.trac.wordpress.org/ticket/53987

#3 @SergeyBiryukov
5 weeks ago

  • Milestone changed from Awaiting Review to 5.9

#4 @SergeyBiryukov
5 weeks ago

Thanks for the PR!

Just noting there also some existing tests for wp_list_filter() in tests/functions/wpListUtil.php.

It looks like:

  • wpListFilter.php has tests for wp_filter_object_list() and wp_list_pluck().
  • wpListUtil.php has tests for wp_list_pluck(), wp_list_filter(), wp_list_sort(), and the WP_List_Util class.

This could probably use some reorganization for clarity and to make sure the tests are not duplicated.

#5 @SergeyBiryukov
5 weeks ago

In 51663:

Tests: Move wp_list_pluck() tests to their own file.

The tests were partially duplicated in two separate files.

Follow-up to [431/tests], [28900], [38928], [42527].

See #53363, #53987.

#6 @SergeyBiryukov
5 weeks ago

In 51664:

Tests: Remove duplicate wp_list_pluck() tests.

The tests were partially duplicated in two separate files, and are now located in their own file.

Follow-up to [431/tests], [28900], [38928], [42527], [51663].

See #53363, #53987.

#7 @SergeyBiryukov
5 weeks ago

In 51665:

Tests: Rename the test file and class for wp_filter_object_list() tests.

This matches the name of the function being tested.

Follow-up to [410/tests], [51663], [51664].

See #53363, #53987.

#8 @SergeyBiryukov
5 weeks ago

In 51666:

Tests: Move wp_list_filter() tests to their own file.

This matches the name of the function being tested.

Follow-up to [38928], [51663-51665].

See #53363, #53987.

#9 @SergeyBiryukov
5 weeks ago

In 51667:

Tests: Move wp_list_sort() tests to their own file.

This matches the name of the function being tested.

Follow-up to [38928], [51663-51666].

See #53363, #53987.

#10 @SergeyBiryukov
5 weeks ago

In 51668:

Coding Standards: Add missing visibility keywords for wp_filter_object_list() and wp_list_pluck() tests.

Follow-up to [51663-51667].

Props pbearne.
See #53363, #53987.

#11 @SergeyBiryukov
5 weeks ago

What's left here:

  • See if wp_list_pluck() tests can be simplified further. Some use older fixtures and some use a data provider, so we could review the older fixtures and move them to the data provider too if it does not cover those cases yet.
  • See if any additional tests for wp_list_filter() are necessary and not already covered by the data provider.
Note: See TracTickets for help on using tickets.