Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (4 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/register.php

    r51657 r52010  
    5151     * Empty render function for tests to use.
    5252     */
    53     function render_stub() {}
     53    public function render_stub() {}
    5454
    5555    /**
     
    5858     * @since 5.0.0
    5959     */
    60     function tear_down() {
     60    public function tear_down() {
    6161        $registry = WP_Block_Type_Registry::get_instance();
    6262
     
    7575     * @return string
    7676     */
    77     function filter_set_locale_to_polish() {
     77    public function filter_set_locale_to_polish() {
    7878        return 'pl_PL';
    7979    }
     
    8282     * @ticket 45109
    8383     */
    84     function test_register_affects_main_registry() {
     84    public function test_register_affects_main_registry() {
    8585        $name     = 'core/test-static';
    8686        $settings = array(
     
    9797     * @ticket 45109
    9898     */
    99     function test_unregister_affects_main_registry() {
     99    public function test_unregister_affects_main_registry() {
    100100        $name     = 'core/test-static';
    101101        $settings = array(
     
    113113     * @ticket 50263
    114114     */
    115     function test_does_not_remove_block_asset_path_prefix() {
     115    public function test_does_not_remove_block_asset_path_prefix() {
    116116        $result = remove_block_asset_path_prefix( 'script-handle' );
    117117
     
    122122     * @ticket 50263
    123123     */
    124     function test_removes_block_asset_path_prefix() {
     124    public function test_removes_block_asset_path_prefix() {
    125125        $result = remove_block_asset_path_prefix( 'file:./block.js' );
    126126
     
    131131     * @ticket 50263
    132132     */
    133     function test_generate_block_asset_handle() {
     133    public function test_generate_block_asset_handle() {
    134134        $block_name = 'unit-tests/my-block';
    135135
     
    159159     * @ticket 50328
    160160     */
    161     function test_generate_block_asset_handle_core_block() {
     161    public function test_generate_block_asset_handle_core_block() {
    162162        $block_name = 'core/paragraph';
    163163
     
    187187     * @ticket 50263
    188188     */
    189     function test_field_not_found_register_block_script_handle() {
     189    public function test_field_not_found_register_block_script_handle() {
    190190        $result = register_block_script_handle( array(), 'script' );
    191191
     
    196196     * @ticket 50263
    197197     */
    198     function test_empty_value_register_block_script_handle() {
     198    public function test_empty_value_register_block_script_handle() {
    199199        $metadata = array( 'script' => '' );
    200200        $result   = register_block_script_handle( $metadata, 'script' );
     
    207207     * @ticket 50263
    208208     */
    209     function test_missing_asset_file_register_block_script_handle() {
     209    public function test_missing_asset_file_register_block_script_handle() {
    210210        $metadata = array(
    211211            'file'   => __FILE__,
     
    221221     * @ticket 50263
    222222     */
    223     function test_handle_passed_register_block_script_handle() {
     223    public function test_handle_passed_register_block_script_handle() {
    224224        $metadata = array(
    225225            'editorScript' => 'test-script-handle',
     
    233233     * @ticket 50263
    234234     */
    235     function test_success_register_block_script_handle() {
     235    public function test_success_register_block_script_handle() {
    236236        $metadata = array(
    237237            'file'   => DIR_TESTDATA . '/blocks/notice/block.json',
     
    247247     * @ticket 50263
    248248     */
    249     function test_field_not_found_register_block_style_handle() {
     249    public function test_field_not_found_register_block_style_handle() {
    250250        $result = register_block_style_handle( array(), 'style' );
    251251
     
    256256     * @ticket 50263
    257257     */
    258     function test_empty_value_found_register_block_style_handle() {
     258    public function test_empty_value_found_register_block_style_handle() {
    259259        $metadata = array( 'style' => '' );
    260260        $result   = register_block_style_handle( $metadata, 'style' );
     
    266266     * @ticket 50263
    267267     */
    268     function test_handle_passed_register_block_style_handle() {
     268    public function test_handle_passed_register_block_style_handle() {
    269269        $metadata = array(
    270270            'style' => 'test-style-handle',
     
    279279     * @ticket 50328
    280280     */
    281     function test_success_register_block_style_handle() {
     281    public function test_success_register_block_style_handle() {
    282282        $metadata = array(
    283283            'file'  => DIR_TESTDATA . '/blocks/notice/block.json',
     
    303303     * @ticket 50263
    304304     */
    305     function test_metadata_not_found_in_wordpress_core() {
     305    public function test_metadata_not_found_in_wordpress_core() {
    306306        $result = register_block_type_from_metadata( 'unknown' );
    307307
     
    315315     * @ticket 50263
    316316     */
    317     function test_metadata_not_found_in_the_current_directory() {
     317    public function test_metadata_not_found_in_the_current_directory() {
    318318        $result = register_block_type_from_metadata( __DIR__ );
    319319
     
    328328     * @ticket 50328
    329329     */
    330     function test_block_registers_with_metadata_fixture() {
     330    public function test_block_registers_with_metadata_fixture() {
    331331        $result = register_block_type_from_metadata(
    332332            DIR_TESTDATA . '/blocks/notice'
     
    415415     * @ticket 53233
    416416     */
    417     function test_block_register_block_type_proxy_for_metadata() {
     417    public function test_block_register_block_type_proxy_for_metadata() {
    418418        $result = register_block_type(
    419419            DIR_TESTDATA . '/blocks/notice'
     
    427427     * @ticket 52301
    428428     */
    429     function test_block_registers_with_metadata_i18n_support() {
     429    public function test_block_registers_with_metadata_i18n_support() {
    430430        add_filter( 'locale', array( $this, 'filter_set_locale_to_polish' ) );
    431431        load_textdomain( 'notice', WP_LANG_DIR . '/plugins/notice-pl_PL.mo' );
     
    473473     * @ticket 45109
    474474     */
    475     function test_get_dynamic_block_names() {
     475    public function test_get_dynamic_block_names() {
    476476        register_block_type( 'core/test-static', array() );
    477477        register_block_type( 'core/test-dynamic', array( 'render_callback' => array( $this, 'render_stub' ) ) );
     
    486486     * @ticket 45109
    487487     */
    488     function test_has_blocks() {
     488    public function test_has_blocks() {
    489489        // Test with passing post ID.
    490490        $this->assertTrue( has_blocks( self::$post_id ) );
Note: See TracChangeset for help on using the changeset viewer.