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-ajax.php

    r51568 r52010  
    3535     * Set up the test fixture.
    3636     */
    37     function set_up() {
     37    public function set_up() {
    3838        parent::set_up();
    3939
     
    5353     * Do Customizer boot actions.
    5454     */
    55     function do_customize_boot_actions() {
     55    private function do_customize_boot_actions() {
    5656        $_SERVER['REQUEST_METHOD'] = 'POST';
    5757        do_action( 'setup_theme' );
     
    6868     * @see WP_Customize_Selective_Refresh::handle_render_partials_request()
    6969     */
    70     function test_handle_render_partials_request_for_unauthenticated_user() {
     70    public function test_handle_render_partials_request_for_unauthenticated_user() {
    7171        $_POST[ WP_Customize_Selective_Refresh::RENDER_QUERY_VAR ] = '1';
    7272
     
    124124     * Set the current user to be an admin, add the preview nonce, and set the query var.
    125125     */
    126     function setup_valid_render_partials_request_environment() {
     126    private function setup_valid_render_partials_request_environment() {
    127127        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
    128128        $_REQUEST['nonce'] = wp_create_nonce( 'preview-customize_' . $this->wp_customize->theme()->get_stylesheet() );
     
    136136     * @see WP_Customize_Selective_Refresh::handle_render_partials_request()
    137137     */
    138     function test_handle_render_partials_request_for_unrecognized_partial() {
     138    public function test_handle_render_partials_request_for_unrecognized_partial() {
    139139        $this->setup_valid_render_partials_request_environment();
    140140        $context_data = array();
     
    173173     * @see WP_Customize_Selective_Refresh::handle_render_partials_request()
    174174     */
    175     function test_handle_render_partials_request_for_non_rendering_partial() {
     175    public function test_handle_render_partials_request_for_non_rendering_partial() {
    176176        $this->setup_valid_render_partials_request_environment();
    177177        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
     
    212212     * @see WP_Customize_Selective_Refresh::handle_render_partials_request()
    213213     */
    214     function test_handle_rendering_disallowed_partial() {
     214    public function test_handle_rendering_disallowed_partial() {
    215215        $this->setup_valid_render_partials_request_environment();
    216216        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
     
    248248     * @see WP_Customize_Selective_Refresh::handle_render_partials_request()
    249249     */
    250     function test_handle_rendering_partial_with_missing_settings() {
     250    public function test_handle_rendering_partial_with_missing_settings() {
    251251        $this->setup_valid_render_partials_request_environment();
    252252        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
     
    280280     * @return string
    281281     */
    282     function render_callback_blogname( $partial, $context ) {
     282    public function render_callback_blogname( $partial, $context ) {
    283283        $this->assertIsArray( $context );
    284284        $this->assertInstanceOf( 'WP_Customize_Partial', $partial );
     
    293293     * @return string
    294294     */
    295     function render_callback_blogdescription( $partial, $context ) {
     295    public function render_callback_blogdescription( $partial, $context ) {
    296296        $this->assertIsArray( $context );
    297297        $this->assertInstanceOf( 'WP_Customize_Partial', $partial );
     
    305305     * @see WP_Customize_Selective_Refresh::handle_render_partials_request()
    306306     */
    307     function test_handle_render_partials_request_with_single_valid_placement() {
     307    public function test_handle_render_partials_request_with_single_valid_placement() {
    308308        $this->setup_valid_render_partials_request_environment();
    309309
     
    354354     * @return array|false Args.
    355355     */
    356     function filter_customize_dynamic_partial_args( $partial_args, $partial_id ) {
     356    public function filter_customize_dynamic_partial_args( $partial_args, $partial_id ) {
    357357        if ( 'test_dynamic_blogname' === $partial_id ) {
    358358            $partial_args = array(
     
    374374     * @return array Response.
    375375     */
    376     function filter_customize_render_partials_response( $response, $component, $partial_placements ) {
     376    public function filter_customize_render_partials_response( $response, $component, $partial_placements ) {
    377377        $this->assertIsArray( $response );
    378378        $this->assertInstanceOf( 'WP_Customize_Selective_Refresh', $component );
     
    396396     * @param array                          $partial_placements Partial IDs.
    397397     */
    398     function handle_action_customize_render_partials_after( $component, $partial_placements ) {
     398    public function handle_action_customize_render_partials_after( $component, $partial_placements ) {
    399399        $this->assertInstanceOf( 'WP_Customize_Selective_Refresh', $component );
    400400        if ( isset( $this->expected_partial_ids ) ) {
     
    409409     * @param array                          $partial_placements Partial IDs.
    410410     */
    411     function handle_action_customize_render_partials_before( $component, $partial_placements ) {
     411    public function handle_action_customize_render_partials_before( $component, $partial_placements ) {
    412412        $this->assertInstanceOf( 'WP_Customize_Selective_Refresh', $component );
    413413        if ( isset( $this->expected_partial_ids ) ) {
     
    421421     * @see WP_Customize_Selective_Refresh::handle_render_partials_request()
    422422     */
    423     function test_handle_render_partials_request_for_dynamic_partial() {
     423    public function test_handle_render_partials_request_for_dynamic_partial() {
    424424        $this->setup_valid_render_partials_request_environment();
    425425        add_filter( 'customize_dynamic_partial_args', array( $this, 'filter_customize_dynamic_partial_args' ), 10, 2 );
     
    459459     * @see WP_Customize_Selective_Refresh::handle_render_partials_request()
    460460     */
    461     function test_handle_render_partials_request_for_multiple_partials_placements() {
     461    public function test_handle_render_partials_request_for_multiple_partials_placements() {
    462462        $this->setup_valid_render_partials_request_environment();
    463463
     
    510510     * Tear down.
    511511     */
    512     function tear_down() {
     512    public function tear_down() {
    513513        $this->expected_partial_ids = null;
    514514        $this->wp_customize         = null;
Note: See TracChangeset for help on using the changeset viewer.