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/partial.php

    r51568 r52010  
    3030     * Set up.
    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_Partial::__construct()
    4646     */
    47     function test_construct_default_args() {
     47    public function test_construct_default_args() {
    4848        $partial_id = 'blogname';
    4949        $partial    = new WP_Customize_Partial( $this->selective_refresh, $partial_id );
     
    6565     * @return string|false Content or false if error.
    6666     */
    67     function render_post_content_partial( $partial ) {
     67    public function render_post_content_partial( $partial ) {
    6868        $id_data = $partial->id_data();
    6969        $post_id = (int) $id_data['keys'][0];
     
    8383     * @see WP_Customize_Partial::__construct()
    8484     */
    85     function test_construct_non_default_args() {
     85    public function test_construct_non_default_args() {
    8686
    8787        $post_id = self::factory()->post->create(
     
    130130     * @see WP_Customize_Partial::id_data()
    131131     */
    132     function test_id_data() {
     132    public function test_id_data() {
    133133        $partial = new WP_Customize_Partial( $this->selective_refresh, 'foo' );
    134134        $id_data = $partial->id_data();
     
    164164     * @return string|false Content.
    165165     */
    166     function filter_customize_partial_render( $rendered, $partial, $container_context ) {
     166    public function filter_customize_partial_render( $rendered, $partial, $container_context ) {
    167167        $this->assertTrue( false === $rendered || is_string( $rendered ) );
    168168        $this->assertInstanceOf( 'WP_Customize_Partial', $partial );
     
    180180     * @return string|false Content.
    181181     */
    182     function filter_customize_partial_render_with_id( $rendered, $partial, $container_context ) {
     182    public function filter_customize_partial_render_with_id( $rendered, $partial, $container_context ) {
    183183        $this->assertSame( sprintf( 'customize_partial_render_%s', $partial->id ), current_filter() );
    184184        $this->assertTrue( false === $rendered || is_string( $rendered ) );
     
    194194     * @return string Content.
    195195     */
    196     function render_echo_and_return() {
     196    public function render_echo_and_return() {
    197197        echo 'foo';
    198198        return 'bar';
     
    202202     * Echo render_callback().
    203203     */
    204     function render_echo() {
     204    public function render_echo() {
    205205        echo 'foo';
    206206    }
     
    211211     * @return string Content.
    212212     */
    213     function render_return() {
     213    public function render_return() {
    214214        return 'bar';
    215215    }
     
    220220     * @see WP_Customize_Partial::render()
    221221     */
    222     function test_render_with_bad_callback_should_give_preference_to_return_value() {
     222    public function test_render_with_bad_callback_should_give_preference_to_return_value() {
    223223        $partial = new WP_Customize_Partial(
    224224            $this->selective_refresh,
     
    237237     * @see WP_Customize_Partial::render()
    238238     */
    239     function test_render_echo_callback() {
     239    public function test_render_echo_callback() {
    240240        $partial                                       = new WP_Customize_Partial(
    241241            $this->selective_refresh,
     
    260260     * @see WP_Customize_Partial::render()
    261261     */
    262     function test_render_return_callback() {
     262    public function test_render_return_callback() {
    263263        $partial                                       = new WP_Customize_Partial(
    264264            $this->selective_refresh,
     
    283283     * @see WP_Customize_Partial::render_callback()
    284284     */
    285     function test_render_callback_default() {
     285    public function test_render_callback_default() {
    286286        $partial = new WP_Customize_Partial( $this->selective_refresh, 'foo' );
    287287        $this->assertFalse( $partial->render_callback( $partial, array() ) );
     
    294294     * @see WP_Customize_Partial::json()
    295295     */
    296     function test_json() {
     296    public function test_json() {
    297297        $post_id    = 123;
    298298        $partial_id = sprintf( 'post_content[%d]', $post_id );
     
    322322     * @see WP_Customize_Partial::check_capabilities()
    323323     */
    324     function test_check_capabilities() {
     324    public function test_check_capabilities() {
    325325        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
    326326        do_action( 'customize_register', $this->wp_customize );
     
    391391     * Tear down.
    392392     */
    393     function tear_down() {
     393    public function tear_down() {
    394394        $this->wp_customize = null;
    395395        unset( $GLOBALS['wp_customize'] );
Note: See TracChangeset for help on using the changeset viewer.