mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@54865 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -322,7 +322,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase {
|
||||
* Saves the action and filter-related globals so they can be restored later.
|
||||
*
|
||||
* Stores $wp_actions, $wp_current_filter, and $wp_filter on a class variable
|
||||
* so they can be restored on tearDown() using _restore_hooks().
|
||||
* so they can be restored on tear_down() using _restore_hooks().
|
||||
*
|
||||
* @global array $wp_actions
|
||||
* @global array $wp_current_filter
|
||||
@@ -340,7 +340,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the hook-related globals to their state at setUp()
|
||||
* Restores the hook-related globals to their state at set_up()
|
||||
* so that future tests aren't affected by hooks set during this last test.
|
||||
*
|
||||
* @global array $wp_actions
|
||||
@@ -1365,11 +1365,12 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase {
|
||||
/**
|
||||
* Deletes files added to the `uploads` directory during tests.
|
||||
*
|
||||
* This method works in tandem with the `setUp()` and `rmdir()` methods:
|
||||
* - `setUp()` scans the `uploads` directory before every test, and stores its contents inside of the
|
||||
* `$ignore_files` property.
|
||||
* - `rmdir()` and its helper methods only delete files that are not listed in the `$ignore_files` property. If
|
||||
* called during `tearDown()` in tests, this will only delete files added during the previously run test.
|
||||
* This method works in tandem with the `set_up()` and `rmdir()` methods:
|
||||
* - `set_up()` scans the `uploads` directory before every test, and stores
|
||||
* its contents inside of the `$ignore_files` property.
|
||||
* - `rmdir()` and its helper methods only delete files that are not listed
|
||||
* in the `$ignore_files` property. If called during `tear_down()` in tests,
|
||||
* this will only delete files added during the previously run test.
|
||||
*/
|
||||
public function remove_added_uploads() {
|
||||
$uploads = wp_upload_dir();
|
||||
|
||||
@@ -37,7 +37,7 @@ abstract class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
|
||||
/**
|
||||
* Generate fixtures to be shared between canonical tests.
|
||||
*
|
||||
* Abstracted here because it's invoked by setUpBeforeClass() in more than one class.
|
||||
* Abstracted here because it's invoked by wpSetUpBeforeClass() in more than one class.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
@@ -46,7 +46,7 @@ abstract class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
|
||||
self::$author_id = $factory->user->create( array( 'user_login' => 'canonical-author' ) );
|
||||
|
||||
/*
|
||||
* Also set in self::setUp(), but we must configure here to make sure that
|
||||
* Also set in self::set_up(), but we must configure here to make sure that
|
||||
* post authorship is properly attributed for fixtures.
|
||||
*/
|
||||
wp_set_current_user( self::$author_id );
|
||||
|
||||
@@ -25,7 +25,7 @@ class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase {
|
||||
/**
|
||||
* Set up the test case.
|
||||
*
|
||||
* @see WP_UnitTestCase::setup()
|
||||
* @see WP_UnitTestCase_Base::set_up()
|
||||
*/
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
@@ -16,7 +16,7 @@ class Test_WP_Customize_Nav_Menu_Item_Setting extends WP_UnitTestCase {
|
||||
/**
|
||||
* Set up a test case.
|
||||
*
|
||||
* @see WP_UnitTestCase::setup()
|
||||
* @see WP_UnitTestCase_Base::set_up()
|
||||
*/
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
@@ -17,7 +17,7 @@ class Test_WP_Customize_Nav_Menu_Setting extends WP_UnitTestCase {
|
||||
/**
|
||||
* Set up a test case.
|
||||
*
|
||||
* @see WP_UnitTestCase::setup()
|
||||
* @see WP_UnitTestCase_Base::set_up()
|
||||
*/
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
@@ -17,7 +17,7 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase {
|
||||
/**
|
||||
* Set up a test case.
|
||||
*
|
||||
* @see WP_UnitTestCase::setup()
|
||||
* @see WP_UnitTestCase_Base::set_up()
|
||||
*/
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
@@ -99,7 +99,7 @@ class Tests_DB_dbDelta extends WP_UnitTestCase {
|
||||
|
||||
parent::tear_down();
|
||||
|
||||
// This has to be called after the parent `tearDown()` method.
|
||||
// This has to be called after the parent `tear_down()` method.
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}dbdelta_test" );
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class Tests_Query_PostStatus extends WP_UnitTestCase {
|
||||
* Register custom post types and statuses used in multiple tests.
|
||||
*
|
||||
* CPTs and CPSs are reset between each test run so need to be registered
|
||||
* in both the wpSetUpBeforeClass() and setUp() methods.
|
||||
* in both the wpSetUpBeforeClass() and set_up() methods.
|
||||
*/
|
||||
public static function register_custom_post_objects() {
|
||||
register_post_type(
|
||||
|
||||
@@ -1707,7 +1707,7 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function nullify_current_user() {
|
||||
// Prevents fatal errors in ::tearDown()'s and other uses of restore_current_blog().
|
||||
// Prevents fatal errors in ::tear_down()'s and other uses of restore_current_blog().
|
||||
$function_stack = wp_debug_backtrace_summary( null, 0, false );
|
||||
if ( in_array( 'restore_current_blog', $function_stack, true ) ) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user