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/dependencies/styles.php

    r51568 r52010  
    1313    private $old_wp_scripts;
    1414
    15     function set_up() {
     15    public function set_up() {
    1616        parent::set_up();
    1717
     
    3838    }
    3939
    40     function tear_down() {
     40    public function tear_down() {
    4141        $GLOBALS['wp_styles']  = $this->old_wp_styles;
    4242        $GLOBALS['wp_scripts'] = $this->old_wp_scripts;
     
    5757     * @ticket 11315
    5858     */
    59     function test_wp_enqueue_style() {
     59    public function test_wp_enqueue_style() {
    6060        wp_enqueue_style( 'no-deps-no-version', 'example.com' );
    6161        wp_enqueue_style( 'no-deps-version', 'example.com', array(), 1.2 );
     
    7878     * @ticket 42804
    7979     */
    80     function test_wp_enqueue_style_with_html5_support_does_not_contain_type_attribute() {
     80    public function test_wp_enqueue_style_with_html5_support_does_not_contain_type_attribute() {
    8181        add_theme_support( 'html5', array( 'style' ) );
    8282
     
    286286     * @ticket 31126
    287287     */
    288     function test_wp_register_style() {
     288    public function test_wp_register_style() {
    289289        $this->assertTrue( wp_register_style( 'duplicate-handler', 'http://example.com' ) );
    290290        $this->assertFalse( wp_register_style( 'duplicate-handler', 'http://example.com' ) );
     
    294294     * @ticket 35229
    295295     */
    296     function test_wp_add_inline_style_for_handle_without_source() {
     296    public function test_wp_add_inline_style_for_handle_without_source() {
    297297        $style = 'a { color: blue; }';
    298298
     
    317317     * @dataProvider data_styles_with_media
    318318     */
    319     function test_wp_enqueue_style_with_media( $expected, $media ) {
     319    public function test_wp_enqueue_style_with_media( $expected, $media ) {
    320320        wp_enqueue_style( 'handle', 'http://example.com', array(), 1, $media );
    321321        $this->assertStringContainsString( $expected, get_echo( 'wp_print_styles' ) );
    322322    }
    323323
    324     function data_styles_with_media() {
     324    public function data_styles_with_media() {
    325325        return array(
    326326            array(
     
    358358     * @covers ::wp_enqueue_style
    359359     */
    360     function test_block_styles_for_editing_without_theme_support() {
     360    public function test_block_styles_for_editing_without_theme_support() {
    361361        // Confirm we are without theme support by default.
    362362        $this->assertFalse( current_theme_supports( 'wp-block-styles' ) );
     
    376376     * @covers ::wp_common_block_scripts_and_styles
    377377     */
    378     function test_block_styles_for_editing_with_theme_support() {
     378    public function test_block_styles_for_editing_with_theme_support() {
    379379        add_theme_support( 'wp-block-styles' );
    380380
     
    394394     * @covers ::wp_enqueue_style
    395395     */
    396     function test_no_block_styles_for_viewing_without_theme_support() {
     396    public function test_no_block_styles_for_viewing_without_theme_support() {
    397397        // Confirm we are without theme support by default.
    398398        $this->assertFalse( current_theme_supports( 'wp-block-styles' ) );
     
    412412     * @covers ::wp_common_block_scripts_and_styles
    413413     */
    414     function test_block_styles_for_viewing_with_theme_support() {
     414    public function test_block_styles_for_viewing_with_theme_support() {
    415415        add_theme_support( 'wp-block-styles' );
    416416
     
    429429     * @covers ::wp_default_styles
    430430     */
    431     function test_block_styles_for_viewing_without_split_styles() {
     431    public function test_block_styles_for_viewing_without_split_styles() {
    432432        add_filter( 'should_load_separate_core_block_assets', '__return_false' );
    433433        wp_default_styles( $GLOBALS['wp_styles'] );
     
    446446     * @covers ::wp_default_styles
    447447     */
    448     function test_block_styles_for_viewing_with_split_styles() {
     448    public function test_block_styles_for_viewing_with_split_styles() {
    449449        add_filter( 'should_load_separate_core_block_assets', '__return_true' );
    450450        wp_default_styles( $GLOBALS['wp_styles'] );
Note: See TracChangeset for help on using the changeset viewer.