WordPress.org

Make WordPress Core

Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#51166 closed defect (bug) (fixed)

Move and update unit tests for selected() and checked()

Reported by: SergeyBiryukov Owned by: SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: good-first-bug has-patch has-unit-tests
Focuses: Cc:

Description

Background: #9862

Unit tests for selected() and checked() functions were added in [231/tests] and expanded in [232/tests].

At the time, the functions were in wp-admin/includes/template.php, so the tests were added to phpunit/tests/admin/includesTemplate.php.

The functions were later moved to wp-includes/general-template.php in [13658], but the tests were never updated for the new location, they should now be in phpunit/tests/general/template.php.

The tests could also be converted to use data providers.

Attachments (1)

51166.diff (4.1 KB) - added by wittich 13 months ago.

Download all attachments as: .zip

Change History (8)

This ticket was mentioned in PR #506 on WordPress/wordpress-develop by wittich.


13 months ago

  • Keywords has-patch has-unit-tests added; needs-patch removed

Unit tests for selected() and checked() functions were added in [231/tests] and expanded in [232/tests].

At the time, the functions were in wp-admin/includes/template.php, so the tests were added to phpunit/tests/admin/includesTemplate.php.

The functions were later moved to wp-includes/general-template.php in [13658], but the tests were never updated for the new location, they should now be in phpunit/tests/general/template.php.

The tests could also be converted to use data providers.

Fixes #51166

This ticket was mentioned in PR #508 on WordPress/wordpress-develop by wittich.


13 months ago

Unit tests for selected() and checked() functions were added in [231/tests] and expanded in [232/tests].

At the time, the functions were in wp-admin/includes/template.php, so the tests were added to phpunit/tests/admin/includesTemplate.php.

The functions were later moved to wp-includes/general-template.php in [13658], but the tests were never updated for the new location, they should now be in phpunit/tests/general/template.php.

The tests could also be converted to use data providers.

Fixes #51166

@wittich
13 months ago

#3 @SergeyBiryukov
13 months ago

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

In 48907:

Tests: Move the tests for selected() and checked() to a more appropriate place.

Convert the tests to use data providers.

Props wittich.
Fixes #51166.

#4 @SergeyBiryukov
13 months ago

Thanks for the patch, it looks great and is exactly what was needed here :)

#5 follow-up: @wittich
13 months ago

Your welcome! What do I do with the PR https://github.com/WordPress/wordpress-develop/pull/508 on GitHub? Close it?

I still did get the whole work flow...

#7 in reply to: ↑ 5 @SergeyBiryukov
13 months ago

Replying to wittich:

What do I do with the PR https://github.com/WordPress/wordpress-develop/pull/508 on GitHub? Close it?

Yeah, when the patch is committed, the PR can be closed.

Note: See TracTickets for help on using tickets.