[wp-trac] [WordPress Trac] #49365: Remove Tests_Post_Types::register_post_type()

WordPress Trac noreply at wordpress.org
Wed Feb 5 06:09:27 UTC 2020


#49365: Remove Tests_Post_Types::register_post_type()
----------------------------------------+------------------------------
 Reporter:  SergeyBiryukov              |       Owner:  (none)
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Build/Test Tools            |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:
----------------------------------------+------------------------------
Description changed by SergeyBiryukov:

Old description:

> [36768] introduced `Tests_Post_Types::register_post_type()` as a helper
> for some tests in `tests/phpunit/tests/post/types.php`.
>
> This method is only used in 6 tests (out of 36 in the file), is
> redundant, and causes a bit of confusion as to why some tests use that
> while others use `register_post_type()` directly.
>
> {{{
> $this->register_post_type( array( ... ) )
> }}}
> can be replaced with:
> {{{
> register_post_type( $this->post_type, array( ... ) );
> }}}

New description:

 [36768] introduced `Tests_Post_Types::register_post_type()` as a helper
 for some tests in `tests/phpunit/tests/post/types.php`.

 This method is only used in 6 tests (out of 36 in the file), is redundant,
 and causes a bit of confusion as to why some tests use that while others
 use `register_post_type()` directly.

 Since `register_post_type()` returns the registered post type object on
 success,
 {{{
 $args = $this->register_post_type( array( ... ) )
 }}}
 can be replaced with:
 {{{
 $args = register_post_type( $this->post_type, array( ... ) );
 }}}

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49365#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list