#42797 closed defect (bug) (fixed)
Add missing parameter description in wp_get_post_parent_id function DocBlock
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.1 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Posts, Post Types | Keywords: | has-patch has-unit-tests |
| Focuses: | docs | Cc: |
Description
The wp_get_post_parent_id function accepts a post ID or a post object to get the parent post id and it defaults to the global post object.
Because the parameter is called $post_ID It needs to be updated to $post
Attachments (2)
Change History (9)
#1
@
8 years ago
- Keywords has-patch has-unit-tests added
In patch 42797.patch the $post_ID parameter is renamed to $post and the description is added. I've added unit tests to see if the original code and new code return the same parent post ids.
#3
@
8 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 42397:
#5
@
8 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening this because the unit tests are not of an acceptable quality:
- Shared fixtures should be used whenever possible. The test suite is already slow, and we should keep it from getting slower unnecessarily.
- The global
$postis an instance ofWP_Post, and not an integer (post id).
Two smaller improvements:
assertSame()should be preferred, because the checks are stricter.assertInstanceOf()is a shorter way to determine the type of an object.
Also the global $post gets reset after every test, so no need to do it manually.
Note: See
TracTickets for help on using
tickets.
Add missing param description and rename $post_ID to $post