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/blocks/editor.php

    r51568 r52010  
    4343    }
    4444
    45     function filter_set_block_categories_post( $block_categories, $post ) {
     45    public function filter_set_block_categories_post( $block_categories, $post ) {
    4646        if ( empty( $post ) ) {
    4747            return $block_categories;
     
    5757    }
    5858
    59     function filter_set_allowed_block_types_post( $allowed_block_types, $post ) {
     59    public function filter_set_allowed_block_types_post( $allowed_block_types, $post ) {
    6060        if ( empty( $post ) ) {
    6161            return $allowed_block_types;
     
    6565    }
    6666
    67     function filter_set_block_editor_settings_post( $editor_settings, $post ) {
     67    public function filter_set_block_editor_settings_post( $editor_settings, $post ) {
    6868        if ( empty( $post ) ) {
    6969            return $allowed_block_types;
     
    7878     * @ticket 52920
    7979     */
    80     function test_block_editor_context_no_settings() {
     80    public function test_block_editor_context_no_settings() {
    8181        $context = new WP_Block_Editor_Context();
    8282
     
    8787     * @ticket 52920
    8888     */
    89     function test_block_editor_context_post() {
     89    public function test_block_editor_context_post() {
    9090        $context = new WP_Block_Editor_Context( array( 'post' => get_post() ) );
    9191
     
    9797     * @expectedDeprecated block_categories
    9898     */
    99     function test_get_block_categories_deprecated_filter_post_object() {
     99    public function test_get_block_categories_deprecated_filter_post_object() {
    100100        add_filter( 'block_categories', array( $this, 'filter_set_block_categories_post' ), 10, 2 );
    101101
     
    120120     * @expectedDeprecated block_categories
    121121     */
    122     function test_get_block_categories_deprecated_filter_post_editor() {
     122    public function test_get_block_categories_deprecated_filter_post_editor() {
    123123        add_filter( 'block_categories', array( $this, 'filter_set_block_categories_post' ), 10, 2 );
    124124
     
    143143     * @ticket 52920
    144144     */
    145     function test_get_allowed_block_types_default() {
     145    public function test_get_allowed_block_types_default() {
    146146        $post_editor_context = new WP_Block_Editor_Context( array( 'post' => get_post() ) );
    147147        $allowed_block_types = get_allowed_block_types( $post_editor_context );
     
    154154     * @expectedDeprecated allowed_block_types
    155155     */
    156     function test_get_allowed_block_types_deprecated_filter_post_editor() {
     156    public function test_get_allowed_block_types_deprecated_filter_post_editor() {
    157157        add_filter( 'allowed_block_types', array( $this, 'filter_set_allowed_block_types_post' ), 10, 2 );
    158158
     
    168168     * @ticket 52920
    169169     */
    170     function test_get_default_block_editor_settings() {
     170    public function test_get_default_block_editor_settings() {
    171171        $settings = get_default_block_editor_settings();
    172172
     
    271271     * @ticket 53397
    272272     */
    273     function test_get_legacy_widget_block_editor_settings() {
     273    public function test_get_legacy_widget_block_editor_settings() {
    274274        $settings = get_legacy_widget_block_editor_settings();
    275275        $this->assertCount( 1, $settings );
     
    300300     * @ticket 52920
    301301     */
    302     function test_get_block_editor_settings_overrides_default_settings_all_editors() {
     302    public function test_get_block_editor_settings_overrides_default_settings_all_editors() {
    303303        function filter_allowed_block_types_my_editor() {
    304304            return array( 'test/filtered-my-block' );
     
    347347     * @ticket 53458
    348348     */
    349     function test_get_block_editor_settings_theme_json_settings() {
     349    public function test_get_block_editor_settings_theme_json_settings() {
    350350        switch_theme( 'block-theme' );
    351351
     
    412412     * @expectedDeprecated block_editor_settings
    413413     */
    414     function test_get_block_editor_settings_deprecated_filter_post_editor() {
     414    public function test_get_block_editor_settings_deprecated_filter_post_editor() {
    415415        add_filter( 'block_editor_settings', array( $this, 'filter_set_block_editor_settings_post' ), 10, 2 );
    416416
     
    431431     * @ticket 52920
    432432     */
    433     function test_block_editor_rest_api_preload_no_paths() {
     433    public function test_block_editor_rest_api_preload_no_paths() {
    434434        $editor_context = new WP_Block_Editor_Context();
    435435        block_editor_rest_api_preload( array(), $editor_context );
     
    443443     * @expectedDeprecated block_editor_preload_paths
    444444     */
    445     function test_block_editor_rest_api_preload_deprecated_filter_post_editor() {
     445    public function test_block_editor_rest_api_preload_deprecated_filter_post_editor() {
    446446        function filter_remove_preload_paths( $preload_paths, $post ) {
    447447            if ( empty( $post ) ) {
     
    469469     * @ticket 52920
    470470     */
    471     function test_block_editor_rest_api_preload_filter_all() {
     471    public function test_block_editor_rest_api_preload_filter_all() {
    472472        function filter_add_preload_paths( $preload_paths, WP_Block_Editor_Context $context ) {
    473473            if ( empty( $context->post ) ) {
     
    498498     * @ticket 53344
    499499     */
    500     function test_get_block_editor_theme_styles() {
     500    public function test_get_block_editor_theme_styles() {
    501501        $theme_styles = get_block_editor_theme_styles();
    502502        $this->assertCount( 1, $theme_styles );
Note: See TracChangeset for help on using the changeset viewer.