WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#36086 closed task (blessed) (fixed)

Custom Logo: Add unit tests

Reported by: obenland Owned by: jorbin
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.6
Component: Customize Keywords: needs-patch
Focuses: Cc:

Description

[36698] introduced custom logos. Let's add some unit tests to make sure the API doesn't break with future changes.

See #33755.

Attachments (2)

36086.diff (3.5 KB) - added by obenland 4 years ago.
36086.1.diff (4.0 KB) - added by obenland 4 years ago.

Download all attachments as: .zip

Change History (13)

@obenland
4 years ago

#1 @obenland
4 years ago

  • Keywords has-patch added

@jorbin, would you mind reviewing these when you get a chance?

#2 @mikeschroder
4 years ago

  • Owner set to jorbin
  • Status changed from new to assigned

This ticket was mentioned in Slack in #core by obenland. View the logs.


4 years ago

#4 @jorbin
4 years ago

test_the_custom_logo feels like it's just making sure that the_custom_logo is a wrapper to echo get_custom_logo. Would it make more sense to test expected HTML output?

Calling _remove_custom_logo() after an assertion means that it may not be run if the assertion fails. We should add that to the teardown.

Tests_WP_Custom_Logo doesn't use the wp_custom_logo property. Looks like it can be eliminated.

@obenland
4 years ago

#5 @obenland
4 years ago

Thanks @jorbin, I updated the patch!

#6 @jorbin
4 years ago

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

In 36905:

Add Automated Tests for custom logo support

[36698] introduced custom logos, this tests the API.

Fixes #36086. See #33755.
Props obenland.

#7 @ocean90
4 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

The output in test_the_custom_logo is different when Twenty Sixteen is active, see https://travis-ci.org/aaronjorbin/develop.wordpress/jobs/114894614#L1183.

#8 @obenland
4 years ago

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

In 36911:

Tests: Account for expected attachemnt size in custom logo output.

Fixes #36086.

#9 @obenland
4 years ago

In 36914:

Tests: Let's not reinvent wp_get_attachment_image().

See https://travis-ci.org/aaronjorbin/develop.wordpress/builds/114913862
See #36086.

#10 @obenland
4 years ago

In 36949:

Tests: Introduce multisite unit tests.

Makes sure custom logo functions work for other sites within a network.
Fixes a bug in get_custom_logo() where the correct logo was returned, but
linked to the wrong site.

H/t ocean90.
See #33755, #36086.

#11 @johnbillion
4 years ago

In 36952:

Correct a unit test for custom icon functionality.

See #36086

Note: See TracTickets for help on using tickets.