Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (3 years ago)
Author:
hellofromTonya
Message:

Coding Standards: Add visibility to methods in tests/phpunit/tests/.

Adds a public visibility to test fixtures, tests, data providers, and callbacks methods.

Adds a private visibility to helper methods within test classes.

Renames callbacks and helpers that previously started with a _ prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit.

Props costdev, jrf, hellofromTonya.
Fixes #54177.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/selective-refresh.php

    r51568 r52010  
    3030     * Set up the test fixture.
    3131     */
    32     function set_up() {
     32    public function set_up() {
    3333        parent::set_up();
    3434        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
     
    4545     * @see WP_Customize_Selective_Refresh::__construct()
    4646     */
    47     function test_construct() {
     47    public function test_construct() {
    4848        $this->assertSame( $this->selective_refresh, $this->wp_customize->selective_refresh );
    4949    }
     
    5454     * @see WP_Customize_Selective_Refresh::register_scripts()
    5555     */
    56     function test_register_scripts() {
     56    public function test_register_scripts() {
    5757        $scripts = new WP_Scripts();
    5858        $handles = array(
     
    7171     * @see WP_Customize_Selective_Refresh::partials()
    7272     */
    73     function test_partials() {
     73    public function test_partials() {
    7474        $this->assertIsArray( $this->selective_refresh->partials() );
    7575    }
     
    8282     * @see WP_Customize_Selective_Refresh::remove_partial()
    8383     */
    84     function test_crud_partial() {
     84    public function test_crud_partial() {
    8585        $partial = $this->selective_refresh->add_partial( 'foo' );
    8686        $this->assertSame( $this->selective_refresh, $partial->component );
     
    111111     * @see WP_Customize_Selective_Refresh::init_preview()
    112112     */
    113     function test_init_preview() {
     113    public function test_init_preview() {
    114114        $this->selective_refresh->init_preview();
    115115        $this->assertSame( 10, has_action( 'template_redirect', array( $this->selective_refresh, 'handle_render_partials_request' ) ) );
     
    122122     * @see WP_Customize_Selective_Refresh::enqueue_preview_scripts()
    123123     */
    124     function test_enqueue_preview_scripts() {
     124    public function test_enqueue_preview_scripts() {
    125125        $scripts = wp_scripts();
    126126        $this->assertNotContains( 'customize-selective-refresh', $scripts->queue );
     
    135135     * @see WP_Customize_Selective_Refresh::export_preview_data()
    136136     */
    137     function test_export_preview_data() {
     137    public function test_export_preview_data() {
    138138        $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
    139139        wp_set_current_user( $user_id );
     
    179179     * @see WP_Customize_Selective_Refresh::add_dynamic_partials()
    180180     */
    181     function test_add_dynamic_partials() {
     181    public function test_add_dynamic_partials() {
    182182        $partial_ids = array( 'recognized', 'recognized-class', 'unrecognized', 'already-added' );
    183183
     
    207207     * @return false|array Dynamic partial args.
    208208     */
    209     function filter_customize_dynamic_partial_args( $partial_args, $partial_id ) {
     209    public function filter_customize_dynamic_partial_args( $partial_args, $partial_id ) {
    210210        $this->assertTrue( false === $partial_args || is_array( $partial_args ) );
    211211        $this->assertIsString( $partial_id );
     
    230230     * @return string
    231231     */
    232     function filter_customize_dynamic_partial_class( $partial_class, $partial_id, $partial_args ) {
     232    public function filter_customize_dynamic_partial_class( $partial_class, $partial_id, $partial_args ) {
    233233        $this->assertIsArray( $partial_args );
    234234        $this->assertIsString( $partial_id );
     
    247247     * @see WP_Customize_Selective_Refresh::is_render_partials_request()
    248248     */
    249     function test_is_render_partials_request() {
     249    public function test_is_render_partials_request() {
    250250        $this->assertFalse( $this->selective_refresh->is_render_partials_request() );
    251251        $_POST[ WP_Customize_Selective_Refresh::RENDER_QUERY_VAR ] = '1';
     
    256256     * Tear down.
    257257     */
    258     function tear_down() {
     258    public function tear_down() {
    259259        $this->wp_customize = null;
    260260        unset( $GLOBALS['wp_customize'] );
Note: See TracChangeset for help on using the changeset viewer.