Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#53516 closed enhancement (fixed)

Add unit tests for `WP_REST_Server->add_site_logo_to_index()`.

Reported by: desrosj's profile desrosj Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.8
Component: REST API Keywords: good-first-bug has-patch has-unit-tests
Focuses: Cc:

Description

Added in [51241].

There are tests for add_active_theme_link_to_index(), which is similar, so those could be used for reference.

Change History (5)

This ticket was mentioned in PR #2003 on WordPress/wordpress-develop by IgnatGeorgiev.


3 years ago
#1

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

Tests: Added a test for the add_site_logo_to_index() method from the WP_REST_Server class.

The test is added into the reset-server.php test package.

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

#3 @SergeyBiryukov
3 years ago

  • Milestone changed from Future Release to 5.9

#4 @SergeyBiryukov
3 years ago

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

In 52381:

Tests: Add an assertion to test the WP_REST_Server::add_site_logo_to_index() method.

Additionally:

  • Move the test for WP_REST_Server::add_active_theme_link_to_index() to a more logical place.
  • Replace assertEquals() with assertSame() in site icon test to also check the type of the value.
  • Use a more consistent pattern for the tests.

Follow-up to [51241], [52080].

Props ignatggeorgiev, desrosj, SergeyBiryukov.
Fixes #53516. See #53363.

SergeyBiryukov commented on PR #2003:


3 years ago
#5

Thanks for the PR! Looking closer, it seems like a separate test method is not necessary here, just adding an assertion to the existing test_get_index() method is enough. Merged in https://core.trac.wordpress.org/changeset/52381.

Note: See TracTickets for help on using tickets.