Make WordPress Core

Changeset 54865


Ignore:
Timestamp:
11/22/2022 09:25:27 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Correct references to set_up() and tear_down() in various DocBlocks.

The setUp() and tearDown() methods were renamed to set_up() and tear_down(), respectively, as part of implementing the void return type solution for PHPUnit 8.0.

Follow-up to [29120], [29251], [30277], [32173], [32806], [38829], [42379], [50450], [51276], [51568].

See #56793.

Location:
trunk/tests/phpunit
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/abstract-testcase.php

    r54366 r54865  
    323323         *
    324324         * Stores $wp_actions, $wp_current_filter, and $wp_filter on a class variable
    325          * so they can be restored on tearDown() using _restore_hooks().
     325         * so they can be restored on tear_down() using _restore_hooks().
    326326         *
    327327         * @global array $wp_actions
    … …  
    341341
    342342        /**
    343          * Restores the hook-related globals to their state at setUp()
     343         * Restores the hook-related globals to their state at set_up()
    344344         * so that future tests aren't affected by hooks set during this last test.
    345345         *
    … …  
    13661366         * Deletes files added to the `uploads` directory during tests.
    13671367         *
    1368          * This method works in tandem with the `setUp()` and `rmdir()` methods:
    1369          * - `setUp()` scans the `uploads` directory before every test, and stores its contents inside of the
    1370          *   `$ignore_files` property.
    1371          * - `rmdir()` and its helper methods only delete files that are not listed in the `$ignore_files` property. If
    1372          *   called during `tearDown()` in tests, this will only delete files added during the previously run test.
     1368         * This method works in tandem with the `set_up()` and `rmdir()` methods:
     1369         * - `set_up()` scans the `uploads` directory before every test, and stores
     1370         *   its contents inside of the `$ignore_files` property.
     1371         * - `rmdir()` and its helper methods only delete files that are not listed
     1372         *   in the `$ignore_files` property. If called during `tear_down()` in tests,
     1373         *   this will only delete files added during the previously run test.
    13731374         */
    13741375        public function remove_added_uploads() {
  • trunk/tests/phpunit/includes/testcase-canonical.php

    r51585 r54865  
    3838         * Generate fixtures to be shared between canonical tests.
    3939         *
    40          * Abstracted here because it's invoked by setUpBeforeClass() in more than one class.
     40         * Abstracted here because it's invoked by wpSetUpBeforeClass() in more than one class.
    4141         *
    4242         * @since 4.1.0
    … …  
    4747
    4848                /*
    49                  * Also set in self::setUp(), but we must configure here to make sure that
     49                 * Also set in self::set_up(), but we must configure here to make sure that
    5050                 * post authorship is properly attributed for fixtures.
    5151                 */
  • trunk/tests/phpunit/tests/customize/custom-css-setting.php

    r54088 r54865  
    2626         * Set up the test case.
    2727         *
    28          * @see WP_UnitTestCase::setup()
     28         * @see WP_UnitTestCase_Base::set_up()
    2929         */
    3030        public function set_up() {
  • trunk/tests/phpunit/tests/customize/nav-menu-item-setting.php

    r52010 r54865  
    1717         * Set up a test case.
    1818         *
    19          * @see WP_UnitTestCase::setup()
     19         * @see WP_UnitTestCase_Base::set_up()
    2020         */
    2121        public function set_up() {
  • trunk/tests/phpunit/tests/customize/nav-menu-setting.php

    r52010 r54865  
    1818         * Set up a test case.
    1919         *
    20          * @see WP_UnitTestCase::setup()
     20         * @see WP_UnitTestCase_Base::set_up()
    2121         */
    2222        public function set_up() {
  • trunk/tests/phpunit/tests/customize/nav-menus.php

    r54090 r54865  
    1818         * Set up a test case.
    1919         *
    20          * @see WP_UnitTestCase::setup()
     20         * @see WP_UnitTestCase_Base::set_up()
    2121         */
    2222        public function set_up() {
  • trunk/tests/phpunit/tests/db/dbDelta.php

    r54711 r54865  
    100100                parent::tear_down();
    101101
    102                 // This has to be called after the parent `tearDown()` method.
     102                // This has to be called after the parent `tear_down()` method.
    103103                $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}dbdelta_test" );
    104104        }
  • trunk/tests/phpunit/tests/query/postStatus.php

    r51568 r54865  
    8888         *
    8989         * CPTs and CPSs are reset between each test run so need to be registered
    90          * in both the wpSetUpBeforeClass() and setUp() methods.
     90         * in both the wpSetUpBeforeClass() and set_up() methods.
    9191         */
    9292        public static function register_custom_post_objects() {
  • trunk/tests/phpunit/tests/user/capabilities.php

    r54673 r54865  
    17081708
    17091709        public function nullify_current_user() {
    1710                 // Prevents fatal errors in ::tearDown()'s and other uses of restore_current_blog().
     1710                // Prevents fatal errors in ::tear_down()'s and other uses of restore_current_blog().
    17111711                $function_stack = wp_debug_backtrace_summary( null, 0, false );
    17121712                if ( in_array( 'restore_current_blog', $function_stack, true ) ) {
Note: See TracChangeset for help on using the changeset viewer.