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/post/wpInsertPost.php

    r51568 r52010  
    3030    }
    3131
    32     static function tear_down_after_class() {
     32    public static function tear_down_after_class() {
    3333        $role = get_role( 'administrator' );
    3434        $role->remove_cap( 'publish_mapped_meta_caps' );
     
    3838    }
    3939
    40     function set_up() {
     40    public function set_up() {
    4141        parent::set_up();
    4242
     
    6969     * @ticket 11863
    7070     */
    71     function test_trashing_a_post_should_add_trashed_suffix_to_post_name() {
     71    public function test_trashing_a_post_should_add_trashed_suffix_to_post_name() {
    7272        $trashed_about_page_id = self::factory()->post->create(
    7373            array(
     
    100100     * @ticket 11863
    101101     */
    102     function test_trashed_posts_original_post_name_should_be_reassigned_after_untrashing() {
     102    public function test_trashed_posts_original_post_name_should_be_reassigned_after_untrashing() {
    103103        $about_page_id = self::factory()->post->create(
    104104            array(
     
    117117     * @ticket 11863
    118118     */
    119     function test_creating_a_new_post_should_add_trashed_suffix_to_post_name_of_trashed_posts_with_the_desired_slug() {
     119    public function test_creating_a_new_post_should_add_trashed_suffix_to_post_name_of_trashed_posts_with_the_desired_slug() {
    120120        $trashed_about_page_id = self::factory()->post->create(
    121121            array(
     
    141141     * @ticket 11863
    142142     */
    143     function test_untrashing_a_post_with_a_stored_desired_post_name_should_get_its_post_name_suffixed_if_another_post_has_taken_the_desired_post_name() {
     143    public function test_untrashing_a_post_with_a_stored_desired_post_name_should_get_its_post_name_suffixed_if_another_post_has_taken_the_desired_post_name() {
    144144        $about_page_id = self::factory()->post->create(
    145145            array(
     
    175175     * @dataProvider data_various_post_statuses
    176176     */
    177     function test_untrashing_a_post_should_always_restore_it_to_draft_status( $post_status ) {
     177    public function test_untrashing_a_post_should_always_restore_it_to_draft_status( $post_status ) {
    178178        $page_id = self::factory()->post->create(
    179179            array(
     
    193193     * @dataProvider data_various_post_statuses
    194194     */
    195     function test_wp_untrash_post_status_filter_restores_post_to_correct_status( $post_status ) {
     195    public function test_wp_untrash_post_status_filter_restores_post_to_correct_status( $post_status ) {
    196196        add_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10, 3 );
    197197
     
    216216     * @return array Array of test arguments.
    217217     */
    218     function data_various_post_types() {
     218    public function data_various_post_types() {
    219219        return array(
    220220            array(
     
    235235     * @return array Array of test arguments.
    236236     */
    237     function data_various_post_statuses() {
     237    public function data_various_post_statuses() {
    238238        return array(
    239239            array(
     
    258258     * @dataProvider data_various_post_types
    259259     */
    260     function test_contributor_cannot_set_post_slug( $post_type ) {
     260    public function test_contributor_cannot_set_post_slug( $post_type ) {
    261261        wp_set_current_user( self::$user_ids['contributor'] );
    262262
     
    297297     * @dataProvider data_various_post_types
    298298     */
    299     function test_administrator_can_set_post_slug( $post_type ) {
     299    public function test_administrator_can_set_post_slug( $post_type ) {
    300300        wp_set_current_user( self::$user_ids['administrator'] );
    301301
     
    338338     * @ticket 42464
    339339     */
    340     function test_administrator_cannot_set_post_slug_on_post_type_they_cannot_publish() {
     340    public function test_administrator_cannot_set_post_slug_on_post_type_they_cannot_publish() {
    341341        wp_set_current_user( self::$user_ids['administrator'] );
    342342
     
    374374     * @ticket 25347
    375375     */
    376     function test_scheduled_post_with_a_past_date_should_be_published() {
     376    public function test_scheduled_post_with_a_past_date_should_be_published() {
    377377
    378378        $now = new DateTimeImmutable( 'now', new DateTimeZone( 'UTC' ) );
Note: See TracChangeset for help on using the changeset viewer.