WordPress.org

Make WordPress Core

Opened 16 months ago

Closed 9 months ago

Last modified 8 days ago

#38157 closed enhancement (fixed)

Add tests for get_post_type_labels()

Reported by: swissspidy Owned by: swissspidy
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

Working on #26511 and #29783, I'd thought it would be a good idea to have tests covering get_post_type_labels() in case we'd have to do some refactoring.

Attachments (1)

38157.diff (4.6 KB) - added by swissspidy 16 months ago.

Download all attachments as: .zip

Change History (8)

@swissspidy
16 months ago

#1 @swissspidy
11 months ago

  • Milestone changed from Awaiting Review to 4.8

IIRC from #38218, some assertions need to be tweaked, but otherwise nothing speaks against adding tests.

#2 @jbpaul17
9 months ago

  • Keywords has-unit-tests added

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


9 months ago

#4 @swissspidy
9 months ago

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

#5 @swissspidy
9 months ago

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

In 40635:

Posts, Post Types: Add initial tests for get_post_type_labels().

See #38218.
Fixes #38157.

#6 @swissspidy
8 days ago

In 42490:

Posts, Post Types: Add tests for get_post_type_labels().

These were accidentally omitted in [38157].

See #38157.

#7 @birgire
8 days ago

Hi @swissspidy

When I skimmed over these methods in [42490] :

test_labels_should_be_added_when_registering_a_post_type()
test_label_should_be_derived_from_labels_when_registering_a_post_type()
test_should_fall_back_on_defaults_when_filtered_labels_do_not_contain_the_keys

I just recalled you comment here on 42044#comment:1 regarding the cleanup.

The first one calls unregister_post_type( 'foo' ) before the assertions but the latter two do it afterwards.

Would the note be relevant in this case?

Last edited 8 days ago by birgire (previous) (diff)
Note: See TracTickets for help on using tickets.