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/includes/factory.php

    r51568 r52010  
    22
    33class TestFactoryFor extends WP_UnitTestCase {
    4     function set_up() {
     4    public function set_up() {
    55        parent::set_up();
    66        $this->category_factory = new WP_UnitTest_Factory_For_Term( null, 'category' );
    77    }
    88
    9     function test_create_creates_a_category() {
     9    public function test_create_creates_a_category() {
    1010        $id = $this->category_factory->create();
    1111        $this->assertTrue( (bool) get_term_by( 'id', $id, 'category' ) );
    1212    }
    1313
    14     function test_get_object_by_id_gets_an_object() {
     14    public function test_get_object_by_id_gets_an_object() {
    1515        $id = $this->category_factory->create();
    1616        $this->assertTrue( (bool) $this->category_factory->get_object_by_id( $id ) );
    1717    }
    1818
    19     function test_get_object_by_id_gets_an_object_with_the_same_name() {
     19    public function test_get_object_by_id_gets_an_object_with_the_same_name() {
    2020        $id     = $this->category_factory->create( array( 'name' => 'Boo' ) );
    2121        $object = $this->category_factory->get_object_by_id( $id );
     
    2323    }
    2424
    25     function test_the_taxonomy_argument_overrules_the_factory_taxonomy() {
     25    public function test_the_taxonomy_argument_overrules_the_factory_taxonomy() {
    2626        $term_factory = new WP_UnitTest_Factory_For_term( null, 'category' );
    2727        $id           = $term_factory->create( array( 'taxonomy' => 'post_tag' ) );
Note: See TracChangeset for help on using the changeset viewer.