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/custom-css-setting.php

    r51568 r52010  
    2828     * @see WP_UnitTestCase::setup()
    2929     */
    30     function set_up() {
     30    public function set_up() {
    3131        parent::set_up();
    3232        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
     
    5555     * Tear down the test case.
    5656     */
    57     function tear_down() {
     57    public function tear_down() {
    5858        $this->setting = null;
    5959        parent::tear_down();
     
    6363     * Delete the $wp_customize global when cleaning up scope.
    6464     */
    65     function clean_up_global_scope() {
     65    public function clean_up_global_scope() {
    6666        global $wp_customize;
    6767        $wp_customize = null;
     
    7878     * @covers WP_Customize_Custom_CSS_Setting::__construct
    7979     */
    80     function test_construct() {
     80    public function test_construct() {
    8181        $this->assertTrue( post_type_exists( 'custom_css' ) );
    8282        $this->assertSame( 'custom_css', $this->setting->type );
     
    111111     * @covers WP_Customize_Custom_CSS_Setting::update
    112112     */
    113     function test_crud() {
     113    public function test_crud() {
    114114
    115115        $this->setting->default = '/* Hello World */';
     
    212212     * @ticket 39032
    213213     */
    214     function test_custom_css_revision_saved() {
     214    public function test_custom_css_revision_saved() {
    215215        $inserted_css = 'body { background: black; }';
    216216        $updated_css  = 'body { background: red; }';
     
    246246     * @ticket 39259
    247247     */
    248     function test_get_custom_css_post_queries_after_failed_lookup() {
     248    public function test_get_custom_css_post_queries_after_failed_lookup() {
    249249        set_theme_mod( 'custom_css_post_id', -1 );
    250250        $queries_before = get_num_queries();
     
    258258     * @ticket 39259
    259259     */
    260     function test_update_custom_css_updates_theme_mod() {
     260    public function test_update_custom_css_updates_theme_mod() {
    261261        set_theme_mod( 'custom_css_post_id', -1 );
    262262        $post = wp_update_custom_css_post( 'body { background: blue; }' );
     
    269269     * @covers WP_Customize_Custom_CSS_Setting::value
    270270     */
    271     function test_value_filter() {
     271    public function test_value_filter() {
    272272        add_filter( 'customize_value_custom_css', array( $this, 'filter_value' ), 10, 2 );
    273273        $this->setting->default = '/*default*/';
     
    298298     * @return string
    299299     */
    300     function filter_value( $value, $setting ) {
     300    public function filter_value( $value, $setting ) {
    301301        $this->assertInstanceOf( 'WP_Customize_Custom_CSS_Setting', $setting );
    302302        $value .= '/*filtered*/';
     
    309309     * @covers WP_Customize_Custom_CSS_Setting::update
    310310     */
    311     function test_update_filter() {
     311    public function test_update_filter() {
    312312        $original_css = 'body { color:red; }';
    313313        $post_id      = $this->factory()->post->create(
     
    344344     * @return array Data.
    345345     */
    346     function filter_update_custom_css_data( $data, $args ) {
     346    public function filter_update_custom_css_data( $data, $args ) {
    347347        $this->assertIsArray( $data );
    348348        $this->assertSameSets( array( 'css', 'preprocessed' ), array_keys( $data ) );
     
    367367     * @covers WP_Customize_Custom_CSS_Setting::validate
    368368     */
    369     function test_validate() {
     369    public function test_validate() {
    370370
    371371        // Empty CSS throws no errors.
Note: See TracChangeset for help on using the changeset viewer.