Make WordPress Core

Changeset 47381


Ignore:
Timestamp:
02/26/2020 01:16:10 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Remove redundant Tests_Post_Types::register_post_type() helper method, use register_post_type() directly.

Props gh640, varunshanbhag.
Fixes #49365.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/types.php

    r47196 r47381  
    7676                 * 'exclude_from_search' Default is null (opposite 'public')
    7777                 */
    78                 $args = $this->register_post_type( array( 'public' => $public = false ) );
     78                $args = register_post_type( $this->post_type, array( 'public' => $public = false ) );
    7979
    8080                $this->assertNotEquals( $public, $args->exclude_from_search );
    … …  
    9090                 * 'publicly_queryable' Default is null ('public')
    9191                 */
    92                 $args = $this->register_post_type( array( 'public' => $public = false ) );
     92                $args = register_post_type( $this->post_type, array( 'public' => $public = false ) );
    9393
    9494                $this->assertSame( $public, $args->publicly_queryable );
    … …  
    104104                 * 'show_ui' Default is null ('public')
    105105                 */
    106                 $args = $this->register_post_type( array( 'public' => $public = false ) );
     106                $args = register_post_type( $this->post_type, array( 'public' => $public = false ) );
    107107
    108108                $this->assertSame( $public, $args->show_ui );
    … …  
    119119                 * 'show_in_menu Default is null ('show_ui' > 'public')
    120120                 */
    121                 $args = $this->register_post_type( array( 'public' => $public = false ) );
     121                $args = register_post_type( $this->post_type, array( 'public' => $public = false ) );
    122122
    123123                // Should fall back to 'show_ui'.
    … …  
    137137                 * 'show_in_nav_menus' Default is null ('public')
    138138                 */
    139                 $args = $this->register_post_type( array( 'public' => $public = false ) );
     139                $args = register_post_type( $this->post_type, array( 'public' => $public = false ) );
    140140
    141141                $this->assertSame( $public, $args->show_in_nav_menus );
    … …  
    152152                 * 'show_in_admin_bar' Default is null ('show_in_menu' > 'show_ui' > 'public')
    153153                 */
    154                 $args = $this->register_post_type( array( 'public' => $public = false ) );
     154                $args = register_post_type( $this->post_type, array( 'public' => $public = false ) );
    155155
    156156                // Should fall back to 'show_in_menu'.
    … …  
    573573                $this->assertEqualSets( array(), get_post_types_by_support( 'somefeature' ) );
    574574        }
    575 
    576         /**
    577          * Serves as a helper to register a post type for tests.
    578          *
    579          * Uses `$this->post_type` initialized in setUp().
    580          *
    581          * @since 4.5.0
    582          *
    583          * @param array $args register_post_type() arguments.
    584          * @return WP_Post_Type Post type object for `$this->post_type`.
    585          */
    586         public function register_post_type( $args = array() ) {
    587                 register_post_type( $this->post_type, $args );
    588                 return get_post_type_object( $this->post_type );
    589         }
    590575}
Note: See TracChangeset for help on using the changeset viewer.