Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#46439 closed task (blessed) (duplicate)

Add missing unit tests for `get_page_by_title()`

Reported by: desrosj's profile desrosj Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Posts, Post Types Keywords: has-patch has-unit-tests
Focuses: Cc:


While looking into the report in #46355, I noticed that there are no unit tests for get_page_by_title().

Attachments (1)

46439.diff (3.6 KB) - added by desrosj 5 years ago.

Download all attachments as: .zip

Change History (4)

5 years ago

#1 @birgire
5 years ago

Looks good @desrosj and runs successfully on my install.

Just minor things I noticed in 46439.diff:

  • I think we could delete this comment in test_get_page_by_title():
    // get_page_by_path() should return a post of the requested type before returning an attachment.
  • There's a global $wpdb; in test_get_page_by_title_with_special_characters() that's not needed.
  • Would be nice to have the file header with title, @since 5.2.0, etc.

#2 @desrosj
5 years ago

  • Milestone 5.2 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for the review, @birgire! I dug a little deeper into Trac today and discovered #36905. That ticket has a unit test patch already and discusses whether to add caching. I am going to close this as a duplicate.

#3 @birgire
5 years ago

yeah good finding @desrosj, hopefully these can be merged later on, e.g. the tests related to ticket #46355 on special chars.

Note: See TracTickets for help on using tickets.