mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Build/Test Tools: Standardise the name, signature, and usage of the wpSetUpBeforeClass() method that's used in test classes.
This brings consistency to this often-used method, and allows IDEs to provide help to developers when using its `$factory` parameter. See #51344 git-svn-id: https://develop.svn.wordpress.org/trunk@49603 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9b97ec4c7d
commit
e8435082d6
@ -15,7 +15,7 @@ class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
|
||||
*/
|
||||
public $structure = '/%year%/%monthnum%/%day%/%postname%/';
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::generate_shared_fixtures( $factory );
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
|
||||
*
|
||||
* @since 4.1.0
|
||||
*/
|
||||
public static function generate_shared_fixtures( $factory ) {
|
||||
public static function generate_shared_fixtures( WP_UnitTest_Factory $factory ) {
|
||||
self::$old_current_user = get_current_user_id();
|
||||
self::$author_id = $factory->user->create( array( 'user_login' => 'canonical-author' ) );
|
||||
|
||||
@ -52,7 +52,7 @@ class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
|
||||
wp_set_current_user( self::$author_id );
|
||||
|
||||
// Already created by install defaults:
|
||||
// self::factory()->term->create( array( 'taxonomy' => 'category', 'name' => 'uncategorized' ) );
|
||||
// $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'uncategorized' ) );
|
||||
|
||||
self::$post_ids[] = $factory->post->create(
|
||||
array(
|
||||
|
||||
@ -24,7 +24,7 @@ class Tests_Admin_IncludesComment extends WP_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = $factory->post->create();
|
||||
|
||||
self::$comment_ids[] = $factory->comment->create(
|
||||
|
||||
@ -19,7 +19,7 @@ class Tests_Admin_includesListTable extends WP_UnitTestCase {
|
||||
$this->table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => 'edit-page' ) );
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
// Note that our top/children/grandchildren arrays are 1-indexed.
|
||||
|
||||
// Create top-level pages.
|
||||
|
||||
@ -12,7 +12,7 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
||||
|
||||
protected static $user_ids = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$user_ids = $factory->user->create_many( 2, array( 'role' => 'author' ) );
|
||||
self::$author_ids = self::$user_ids;
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ class Tests_Admin_Includes_Schema extends WP_UnitTestCase {
|
||||
/**
|
||||
* Make sure the schema code is loaded before the tests are run.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass() {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
global $wpdb;
|
||||
|
||||
self::$options = 'testprefix_options';
|
||||
|
||||
@ -20,7 +20,7 @@ class Tests_AdminBar extends WP_UnitTestCase {
|
||||
parent::setUpBeforeClass();
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
self::$user_ids[] = self::$editor_id;
|
||||
self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
|
||||
|
||||
@ -28,7 +28,7 @@ class Tests_Ajax_Autosave extends WP_Ajax_UnitTestCase {
|
||||
protected static $post_id;
|
||||
protected static $user_ids = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
|
||||
self::$user_ids[] = self::$admin_id;
|
||||
self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
|
||||
@ -42,7 +42,7 @@ class Tests_Ajax_CustomizeManager extends WP_Ajax_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$subscriber_user_id = $factory->user->create( array( 'role' => 'subscriber' ) );
|
||||
self::$admin_user_id = $factory->user->create( array( 'role' => 'administrator' ) );
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ class Tests_Ajax_DeleteComment extends WP_Ajax_UnitTestCase {
|
||||
*/
|
||||
protected static $post_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = $factory->post->create();
|
||||
|
||||
$comment_ids = $factory->comment->create_post_comments( self::$post_id, 8 );
|
||||
|
||||
@ -31,7 +31,7 @@ class Tests_Ajax_GetComments extends WP_Ajax_UnitTestCase {
|
||||
|
||||
protected static $comment_ids = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$comment_post = $factory->post->create_and_get();
|
||||
self::$comment_ids = $factory->comment->create_post_comments( self::$comment_post->ID, 5 );
|
||||
self::$no_comment_post = $factory->post->create_and_get();
|
||||
|
||||
@ -113,7 +113,7 @@ class Tests_Ajax_PrivacyErasePersonalData extends WP_Ajax_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$request_email = 'requester@example.com';
|
||||
self::$request_id = wp_create_user_request( self::$request_email, 'remove_personal_data' );
|
||||
self::$action = 'wp-privacy-erase-personal-data';
|
||||
|
||||
@ -124,7 +124,7 @@ class Tests_Ajax_PrivacyExportPersonalData extends WP_Ajax_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$request_email = 'requester@example.com';
|
||||
self::$request_id = wp_create_user_request( self::$request_email, 'export_personal_data' );
|
||||
self::$action = 'wp-privacy-export-personal-data';
|
||||
|
||||
@ -31,7 +31,7 @@ class Tests_Ajax_ReplytoComment extends WP_Ajax_UnitTestCase {
|
||||
|
||||
protected static $comment_ids = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$comment_post = $factory->post->create_and_get();
|
||||
self::$comment_ids = $factory->comment->create_post_comments( self::$comment_post->ID, 5 );
|
||||
self::$draft_post = $factory->post->create_and_get( array( 'post_status' => 'draft' ) );
|
||||
|
||||
@ -31,7 +31,7 @@ class Tests_Ajax_TagSearch extends WP_Ajax_UnitTestCase {
|
||||
|
||||
private static $term_ids = array();
|
||||
|
||||
public static function wpSetUpBeforeClass() {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
foreach ( self::$terms as $t ) {
|
||||
self::$term_ids[] = wp_insert_term( $t, 'post_tag' );
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
class Tests_Attachment_Slashes extends WP_UnitTestCase {
|
||||
protected static $author_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$author_id = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ class Tests_Auth extends WP_UnitTestCase {
|
||||
*/
|
||||
protected $nonce_failure_hook = 'wp_verify_nonce_failed';
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$_user = $factory->user->create_and_get(
|
||||
array(
|
||||
'user_login' => 'password-tests',
|
||||
|
||||
@ -45,21 +45,21 @@ class WP_Test_Block_Type extends WP_UnitTestCase {
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public static function wpSetUpBeforeClass() {
|
||||
self::$editor_user_id = self::factory()->user->create(
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$editor_user_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'editor',
|
||||
)
|
||||
);
|
||||
|
||||
self::$post_with_blocks = self::factory()->post->create(
|
||||
self::$post_with_blocks = $factory->post->create(
|
||||
array(
|
||||
'post_title' => 'Example',
|
||||
'post_content' => "<!-- wp:core/text {\"dropCap\":true} -->\n<p class=\"has-drop-cap\">Tester</p>\n<!-- /wp:core/text -->",
|
||||
)
|
||||
);
|
||||
|
||||
self::$post_without_blocks = self::factory()->post->create(
|
||||
self::$post_without_blocks = $factory->post->create(
|
||||
array(
|
||||
'post_title' => 'Example',
|
||||
'post_content' => 'Tester',
|
||||
|
||||
@ -29,7 +29,7 @@ class WP_Test_Block_Register extends WP_UnitTestCase {
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_content' => file_get_contents( DIR_TESTDATA . '/blocks/do-blocks-original.html' ),
|
||||
|
||||
@ -43,7 +43,7 @@ class WP_Test_Render_Reusable_Blocks extends WP_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Helper that creates fake data.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$user_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'editor',
|
||||
|
||||
@ -9,7 +9,7 @@ class Tests_Canonical_Category extends WP_Canonical_UnitTestCase {
|
||||
public static $posts = array();
|
||||
public static $cats = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
|
||||
self::$posts[0] = $factory->post->create( array( 'post_name' => 'post0' ) );
|
||||
self::$posts[1] = $factory->post->create( array( 'post_name' => 'post1' ) );
|
||||
|
||||
@ -21,7 +21,7 @@ class Tests_Canonical_PostStatus extends WP_Canonical_UnitTestCase {
|
||||
*/
|
||||
public static $posts;
|
||||
|
||||
public static function wpSetupBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::setup_custom_types();
|
||||
self::$users = array(
|
||||
'anon' => 0,
|
||||
|
||||
@ -11,7 +11,7 @@ class Tests_Comment_Submission extends WP_UnitTestCase {
|
||||
|
||||
protected $preprocess_comment_data = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post = $factory->post->create_and_get();
|
||||
|
||||
self::$author_id = $factory->user->create(
|
||||
|
||||
@ -13,7 +13,7 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
reset_phpmailer_instance();
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$user_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'author',
|
||||
|
||||
@ -22,7 +22,7 @@ class Tests_Comment_GetCommentAuthorEmailLink extends WP_UnitTestCase {
|
||||
add_filter( 'comment_email', 'antispambot' );
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$comment = $factory->comment->create_and_get(
|
||||
array(
|
||||
'comment_author_email' => 'foo@example.org',
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
class Tests_Comment_GetCommentAuthorUrlLink extends WP_UnitTestCase {
|
||||
protected static $comments = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
unset( $GLOBALS['comment'] );
|
||||
|
||||
$comment_ids = $factory->comment->create_post_comments( 0, 1 );
|
||||
|
||||
@ -7,46 +7,46 @@ class Tests_Comment_GetCommentLink extends WP_UnitTestCase {
|
||||
protected static $p;
|
||||
protected static $comments = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
$now = time();
|
||||
self::$p = self::factory()->post->create();
|
||||
self::$p = $factory->post->create();
|
||||
|
||||
self::$comments[] = self::factory()->comment->create(
|
||||
self::$comments[] = $factory->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$p,
|
||||
'comment_content' => '1',
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ),
|
||||
)
|
||||
);
|
||||
self::$comments[] = self::factory()->comment->create(
|
||||
self::$comments[] = $factory->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$p,
|
||||
'comment_content' => '2',
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ),
|
||||
)
|
||||
);
|
||||
self::$comments[] = self::factory()->comment->create(
|
||||
self::$comments[] = $factory->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$p,
|
||||
'comment_content' => '3',
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ),
|
||||
)
|
||||
);
|
||||
self::$comments[] = self::factory()->comment->create(
|
||||
self::$comments[] = $factory->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$p,
|
||||
'comment_content' => '4',
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 400 ),
|
||||
)
|
||||
);
|
||||
self::$comments[] = self::factory()->comment->create(
|
||||
self::$comments[] = $factory->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$p,
|
||||
'comment_content' => '4',
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 500 ),
|
||||
)
|
||||
);
|
||||
self::$comments[] = self::factory()->comment->create(
|
||||
self::$comments[] = $factory->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$p,
|
||||
'comment_content' => '4',
|
||||
|
||||
@ -9,7 +9,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
|
||||
protected static $post_id;
|
||||
protected $comment_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = $factory->post->create();
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ class Tests_Comment_Slashes extends WP_UnitTestCase {
|
||||
protected static $author_id;
|
||||
protected static $post_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
// We need an admin user to bypass comment flood protection.
|
||||
self::$author_id = $factory->user->create( array( 'role' => 'administrator' ) );
|
||||
self::$post_id = $factory->post->create();
|
||||
|
||||
@ -7,7 +7,7 @@ class Tests_Comment_WpAllowComment extends WP_UnitTestCase {
|
||||
protected static $post_id;
|
||||
protected static $comment_id;
|
||||
|
||||
public static function wpSetupBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = $factory->post->create();
|
||||
self::$comment_id = $factory->comment->create(
|
||||
array(
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
class Tests_Term_WpComment extends WP_UnitTestCase {
|
||||
protected static $comment_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
global $wpdb;
|
||||
|
||||
// Ensure that there is a comment with ID 1.
|
||||
@ -22,7 +22,7 @@ class Tests_Term_WpComment extends WP_UnitTestCase {
|
||||
clean_comment_cache( 1 );
|
||||
}
|
||||
|
||||
self::$comment_id = self::factory()->comment->create();
|
||||
self::$comment_id = $factory->comment->create();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -45,7 +45,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$subscriber_user_id = $factory->user->create( array( 'role' => 'subscriber' ) );
|
||||
self::$admin_user_id = $factory->user->create( array( 'role' => 'administrator' ) );
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ class Tests_WP_Customize_Section extends WP_UnitTestCase {
|
||||
protected static $admin_id;
|
||||
protected static $user_ids = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
|
||||
self::$user_ids[] = self::$admin_id;
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ class Tests_Feeds_Atom extends WP_UnitTestCase {
|
||||
/**
|
||||
* Setup a new user and attribute some posts.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
// Create a user.
|
||||
self::$user_id = $factory->user->create(
|
||||
array(
|
||||
|
||||
@ -17,7 +17,7 @@ class Tests_Feeds_RSS2 extends WP_UnitTestCase {
|
||||
/**
|
||||
* Setup a new user and attribute some posts.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
// Create a user.
|
||||
self::$user_id = $factory->user->create(
|
||||
array(
|
||||
|
||||
@ -16,7 +16,7 @@ class Tests_Functions_wpGetArchives extends WP_UnitTestCase {
|
||||
$this->year_url = get_year_link( gmdate( 'Y' ) );
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_ids = $factory->post->create_many(
|
||||
8,
|
||||
array(
|
||||
|
||||
@ -8,7 +8,7 @@ class Tests_L10n_loadTextdomain extends WP_UnitTestCase {
|
||||
protected $locale;
|
||||
protected static $user_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$user_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'administrator',
|
||||
|
||||
@ -10,7 +10,7 @@ class Tests_L10n_loadTextdomainJustInTime extends WP_UnitTestCase {
|
||||
protected static $user_id;
|
||||
private $locale_count;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$user_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'administrator',
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
class Tests_Link_GetDashboardUrl extends WP_UnitTestCase {
|
||||
public static $user_id = false;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$user_id = $factory->user->create( array( 'role' => 'administrator' ) );
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ class Tests_Link_GetThePrivacyPolicyLink extends WP_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory The base factory object.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$privacy_policy_page_id = $factory->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
class Tests_WpGetCanonicalURL extends WP_UnitTestCase {
|
||||
public static $post_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_content' => 'Page 1 <!--nextpage--> Page 2 <!--nextpage--> Page 3',
|
||||
|
||||
@ -9,7 +9,7 @@ class Tests_Media extends WP_UnitTestCase {
|
||||
protected static $_sizes;
|
||||
protected static $large_filename = 'test-image-large.jpg';
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$_sizes = wp_get_additional_image_sizes();
|
||||
$GLOBALS['_wp_additional_image_sizes'] = array();
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ class Tests_Meta_Register_Meta extends WP_UnitTestCase {
|
||||
protected static $comment_id;
|
||||
protected static $user_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = $factory->post->create( array( 'post_type' => 'page' ) );
|
||||
self::$term_id = $factory->term->create( array( 'taxonomy' => 'category' ) );
|
||||
self::$comment_id = $factory->comment->create();
|
||||
|
||||
@ -11,7 +11,7 @@ class Tests_Meta_Slashes extends WP_UnitTestCase {
|
||||
protected static $comment_id;
|
||||
protected static $user_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
self::$post_id = $factory->post->create();
|
||||
self::$comment_id = $factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );
|
||||
|
||||
@ -12,7 +12,7 @@ if ( is_multisite() ) :
|
||||
protected static $network_ids;
|
||||
protected static $site_ids;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$network_ids = array(
|
||||
'wordpress.org/' => array(
|
||||
'domain' => 'wordpress.org',
|
||||
|
||||
@ -11,7 +11,7 @@ if ( is_multisite() ) :
|
||||
protected static $network_ids;
|
||||
protected static $site_ids;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$site_ids = array(
|
||||
WP_TESTS_DOMAIN . '/foo/' => array(
|
||||
'domain' => WP_TESTS_DOMAIN,
|
||||
|
||||
@ -12,7 +12,7 @@ if ( is_multisite() ) :
|
||||
protected static $network_ids;
|
||||
protected static $site_ids;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$network_ids = array(
|
||||
'wordpress.org/' => array(
|
||||
'domain' => 'wordpress.org',
|
||||
|
||||
@ -12,7 +12,7 @@ if ( is_multisite() ) :
|
||||
protected static $network_ids;
|
||||
protected static $site_ids;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$network_ids = array(
|
||||
'wordpress.org/' => array(
|
||||
'domain' => 'wordpress.org',
|
||||
|
||||
@ -10,7 +10,7 @@ if ( is_multisite() ) :
|
||||
class Tests_Multisite_Get_Site extends WP_UnitTestCase {
|
||||
protected static $site_ids;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$site_ids = array(
|
||||
'wordpress.org/' => array(
|
||||
'domain' => 'wordpress.org',
|
||||
|
||||
@ -28,7 +28,7 @@ if ( is_multisite() ) :
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$different_network_id = $factory->network->create(
|
||||
array(
|
||||
'domain' => 'wordpress.org',
|
||||
|
||||
@ -26,7 +26,7 @@ if ( is_multisite() ) :
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$network_ids = array(
|
||||
'wordpress.org/' => array(
|
||||
'domain' => 'wordpress.org',
|
||||
|
||||
@ -29,7 +29,7 @@ if ( is_multisite() ) :
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$network_ids = array(
|
||||
'make.wordpress.org/' => array(
|
||||
'domain' => 'make.wordpress.org',
|
||||
|
||||
@ -13,7 +13,7 @@ if ( is_multisite() ) :
|
||||
protected static $site_id2;
|
||||
protected static $flag_was_set;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$site_id = $factory->blog->create(
|
||||
array(
|
||||
'domain' => 'wordpress.org',
|
||||
|
||||
@ -26,7 +26,7 @@ if ( is_multisite() ) :
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$network_ids = array(
|
||||
'wordpress.org/' => array(
|
||||
'domain' => 'wordpress.org',
|
||||
|
||||
@ -10,7 +10,7 @@ if ( is_multisite() ) :
|
||||
class Tests_Multisite_WP_Get_Sites extends WP_UnitTestCase {
|
||||
protected static $site_ids;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$site_ids = array(
|
||||
'w.org/' => array(
|
||||
'domain' => 'w.org',
|
||||
|
||||
@ -19,7 +19,7 @@ if ( is_multisite() ) :
|
||||
$this->table = _get_list_table( 'WP_MS_Sites_List_Table', array( 'screen' => 'ms-sites' ) );
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$site_ids = array(
|
||||
'wordpress.org/' => array(
|
||||
'domain' => 'wordpress.org',
|
||||
|
||||
@ -16,7 +16,7 @@ if ( is_multisite() ) :
|
||||
|
||||
protected $minimum_site_name_length = 4;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$super_admin_id = $factory->user->create();
|
||||
grant_super_admin( self::$super_admin_id );
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
|
||||
const INVALID_OEMBED_URL = 'https://www.notreallyanoembedprovider.com/watch?v=awesome-cat-video';
|
||||
const UNTRUSTED_PROVIDER_URL = 'https://www.untrustedprovider.com';
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$subscriber = $factory->user->create(
|
||||
array(
|
||||
'role' => 'subscriber',
|
||||
|
||||
@ -9,7 +9,7 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
protected static $editor_id;
|
||||
protected static $grammarian_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
|
||||
add_role(
|
||||
|
||||
@ -16,7 +16,7 @@ class Tests_Post_Meta extends WP_UnitTestCase {
|
||||
protected static $post_id;
|
||||
protected static $post_id_2;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$author = $factory->user->create_and_get( array( 'role' => 'editor' ) );
|
||||
|
||||
self::$post_id = $factory->post->create(
|
||||
|
||||
@ -9,7 +9,7 @@ class Tests_Post_Revisions extends WP_UnitTestCase {
|
||||
protected static $editor_user_id;
|
||||
protected static $author_user_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$admin_user_id = $factory->user->create( array( 'role' => 'administrator' ) );
|
||||
self::$editor_user_id = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
self::$author_user_id = $factory->user->create( array( 'role' => 'author' ) );
|
||||
|
||||
@ -9,7 +9,7 @@ class Tests_Post_Slashes extends WP_UnitTestCase {
|
||||
protected static $author_id;
|
||||
protected static $post_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$author_id = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
self::$post_id = $factory->post->create();
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ class Tests_Post_Thumbnail_Template extends WP_UnitTestCase {
|
||||
protected $current_size_filter_data = null;
|
||||
protected $current_size_filter_result = null;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post = $factory->post->create_and_get();
|
||||
self::$different_post = $factory->post->create_and_get();
|
||||
|
||||
|
||||
@ -18,9 +18,9 @@ class Tests_Post_wpGetPostParentId extends WP_UnitTestCase {
|
||||
*/
|
||||
public static $post_id;
|
||||
|
||||
public static function wpSetUpBeforeClass() {
|
||||
self::$parent_post_id = self::factory()->post->create();
|
||||
self::$post_id = self::factory()->post->create( array( 'post_parent' => self::$parent_post_id ) );
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$parent_post_id = $factory->post->create();
|
||||
self::$post_id = $factory->post->create( array( 'post_parent' => self::$parent_post_id ) );
|
||||
}
|
||||
|
||||
public function test_wp_get_post_parent_id_with_post_object() {
|
||||
|
||||
@ -10,7 +10,7 @@ class Tests_Post_wpInsertPost extends WP_UnitTestCase {
|
||||
'contributor' => null,
|
||||
);
|
||||
|
||||
static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$user_ids = array(
|
||||
'administrator' => $factory->user->create(
|
||||
array(
|
||||
|
||||
@ -53,15 +53,15 @@ class Tests_Post_wpListPages extends WP_UnitTestCase {
|
||||
*/
|
||||
public static $time;
|
||||
|
||||
public static function wpSetupBeforeClass() {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$time = time();
|
||||
|
||||
$post_date = gmdate( 'Y-m-d H:i:s', self::$time );
|
||||
|
||||
self::$editor = self::factory()->user->create( array( 'role' => 'editor' ) );
|
||||
self::$author = self::factory()->user->create( array( 'role' => 'author' ) );
|
||||
self::$editor = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
self::$author = $factory->user->create( array( 'role' => 'author' ) );
|
||||
|
||||
self::$parent_1 = self::factory()->post->create(
|
||||
self::$parent_1 = $factory->post->create(
|
||||
array(
|
||||
'post_author' => self::$editor,
|
||||
'post_type' => 'page',
|
||||
@ -70,7 +70,7 @@ class Tests_Post_wpListPages extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
self::$parent_2 = self::factory()->post->create(
|
||||
self::$parent_2 = $factory->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
'post_title' => 'Parent 2',
|
||||
@ -78,7 +78,7 @@ class Tests_Post_wpListPages extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
self::$parent_3 = self::factory()->post->create(
|
||||
self::$parent_3 = $factory->post->create(
|
||||
array(
|
||||
'post_author' => self::$author,
|
||||
'post_type' => 'page',
|
||||
@ -88,7 +88,7 @@ class Tests_Post_wpListPages extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
foreach ( array( self::$parent_1, self::$parent_2, self::$parent_3 ) as $page ) {
|
||||
self::$children[ $page ][] = self::factory()->post->create(
|
||||
self::$children[ $page ][] = $factory->post->create(
|
||||
array(
|
||||
'post_parent' => $page,
|
||||
'post_type' => 'page',
|
||||
@ -96,7 +96,7 @@ class Tests_Post_wpListPages extends WP_UnitTestCase {
|
||||
'post_date' => $post_date,
|
||||
)
|
||||
);
|
||||
self::$children[ $page ][] = self::factory()->post->create(
|
||||
self::$children[ $page ][] = $factory->post->create(
|
||||
array(
|
||||
'post_parent' => $page,
|
||||
'post_type' => 'page',
|
||||
@ -104,7 +104,7 @@ class Tests_Post_wpListPages extends WP_UnitTestCase {
|
||||
'post_date' => $post_date,
|
||||
)
|
||||
);
|
||||
self::$children[ $page ][] = self::factory()->post->create(
|
||||
self::$children[ $page ][] = $factory->post->create(
|
||||
array(
|
||||
'post_parent' => $page,
|
||||
'post_type' => 'page',
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
class Tests_Post_wpPost extends WP_UnitTestCase {
|
||||
protected static $post_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
global $wpdb;
|
||||
|
||||
// Ensure that there is a post with ID 1.
|
||||
@ -20,7 +20,7 @@ class Tests_Post_wpPost extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
self::$post_id = self::factory()->post->create();
|
||||
self::$post_id = $factory->post->create();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -17,7 +17,7 @@ class Tests_Post_wpPublishPost extends WP_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Test suite factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$auto_draft_id = $factory->post->create( array( 'post_status' => 'auto-draft' ) );
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ class Tests_WpCreateUserRequest extends WP_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$registered_user_email = 'export@local.test';
|
||||
self::$non_registered_user_email = 'non-registered-user@local.test';
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ class Tests_WpPrivacyCompletedRequest extends WP_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$request_id = wp_create_user_request( 'requester@example.com', 'export_personal_data' );
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ class Tests_Privacy_WpPrivacyDeleteOldExportFiles extends WP_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory The base factory object.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
$exports_dir = wp_privacy_exports_dir();
|
||||
|
||||
if ( ! is_dir( $exports_dir ) ) {
|
||||
|
||||
@ -50,7 +50,7 @@ class Tests_Privacy_WpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory The base factory object.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$export_request_id = wp_create_user_request( 'export-requester@example.com', 'export_personal_data' );
|
||||
update_post_meta( self::$export_request_id, '_export_data_grouped', array() );
|
||||
self::$exports_dir = wp_privacy_exports_dir();
|
||||
|
||||
@ -147,7 +147,7 @@ class Tests_Privacy_WpPrivacyProcessPersonalDataExportPage extends WP_UnitTestCa
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$requester_email = 'requester@example.com';
|
||||
self::$exports_url = wp_privacy_exports_url();
|
||||
self::$export_file_name = 'wp-personal-data-file-Wv0RfMnGIkl4CFEDEEkSeIdfLmaUrLsl.zip';
|
||||
|
||||
@ -59,7 +59,7 @@ class Tests_Privacy_WpPrivacySendErasureFulfillmentNotification extends WP_UnitT
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$requester_email = 'erase-my-data@local.test';
|
||||
self::$request_user = $factory->user->create_and_get(
|
||||
array(
|
||||
|
||||
@ -80,7 +80,7 @@ class Tests_Privacy_WpPrivacySendPersonalDataExportEmail extends WP_UnitTestCase
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$requester_email = 'requester@example.com';
|
||||
self::$request_user = $factory->user->create_and_get(
|
||||
array(
|
||||
|
||||
@ -18,17 +18,17 @@ class Tests_Query_CommentCount extends WP_UnitTestCase {
|
||||
unset( $this->q );
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
$post_id = self::factory()->post->create(
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_content' => 1 . rand_str() . ' about',
|
||||
'post_type' => self::$post_type,
|
||||
)
|
||||
);
|
||||
self::$post_ids[1][] = $post_id;
|
||||
self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) );
|
||||
$factory->comment->create( array( 'comment_post_ID' => $post_id ) );
|
||||
|
||||
$post_id = self::factory()->post->create(
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_content' => 1 . rand_str() . ' about',
|
||||
'post_type' => self::$post_type,
|
||||
@ -36,10 +36,10 @@ class Tests_Query_CommentCount extends WP_UnitTestCase {
|
||||
);
|
||||
self::$post_ids[4][] = $post_id;
|
||||
for ( $i = 0; $i < 4; $i++ ) {
|
||||
self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) );
|
||||
$factory->comment->create( array( 'comment_post_ID' => $post_id ) );
|
||||
}
|
||||
|
||||
$post_id = self::factory()->post->create(
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_content' => 1 . rand_str() . ' about',
|
||||
'post_type' => self::$post_type,
|
||||
@ -47,10 +47,10 @@ class Tests_Query_CommentCount extends WP_UnitTestCase {
|
||||
);
|
||||
self::$post_ids[5][] = $post_id;
|
||||
for ( $i = 0; $i < 5; $i++ ) {
|
||||
self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) );
|
||||
$factory->comment->create( array( 'comment_post_ID' => $post_id ) );
|
||||
}
|
||||
|
||||
$post_id = self::factory()->post->create(
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_content' => 1 . rand_str() . ' about',
|
||||
'post_type' => self::$post_type,
|
||||
@ -58,7 +58,7 @@ class Tests_Query_CommentCount extends WP_UnitTestCase {
|
||||
);
|
||||
self::$post_ids[5][] = $post_id;
|
||||
for ( $i = 0; $i < 5; $i++ ) {
|
||||
self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) );
|
||||
$factory->comment->create( array( 'comment_post_ID' => $post_id ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ class Tests_Query_Date extends WP_UnitTestCase {
|
||||
|
||||
public static $post_ids = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
// Be careful modifying this. Tests are coded to expect this exact sample data.
|
||||
$post_dates = array(
|
||||
'1972-05-24 14:53:45',
|
||||
|
||||
@ -11,7 +11,7 @@ class Tests_Query_PostStatus extends WP_UnitTestCase {
|
||||
public static $editor_privatefoo_post;
|
||||
public static $author_privatefoo_post;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$editor_user_id = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
self::$author_user_id = $factory->user->create( array( 'role' => 'author' ) );
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
public static $child_three;
|
||||
public static $child_four;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
$cat_a = $factory->term->create(
|
||||
array(
|
||||
'taxonomy' => 'category',
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
class Tests_Query_Stickies extends WP_UnitTestCase {
|
||||
public static $posts = array();
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
// Set post times to get a reliable order.
|
||||
$now = time();
|
||||
for ( $i = 0; $i <= 22; $i++ ) {
|
||||
|
||||
@ -36,7 +36,7 @@ class WP_Test_REST_Application_Passwords_Controller extends WP_Test_REST_Control
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory WordPress unit test factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$subscriber_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'subscriber',
|
||||
|
||||
@ -29,7 +29,7 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||
*/
|
||||
private $test_file2;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$superadmin_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'administrator',
|
||||
|
||||
@ -47,7 +47,7 @@ class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controlle
|
||||
$this->assertArrayHasKey( 'title', $data );
|
||||
}
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = $factory->post->create();
|
||||
self::$page_id = $factory->post->create( array( 'post_type' => 'page' ) );
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ class WP_REST_Block_Directory_Controller_Test extends WP_Test_REST_Controller_Te
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory WordPress unit test factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$admin_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'administrator',
|
||||
|
||||
@ -98,7 +98,7 @@ class REST_Block_Renderer_Controller_Test extends WP_Test_REST_Controller_Testca
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Helper that lets us create fake data.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$user_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'editor',
|
||||
|
||||
@ -44,7 +44,7 @@ class REST_Block_Type_Controller_Test extends WP_Test_REST_Controller_Testcase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Helper that lets us create fake data.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$admin_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'administrator',
|
||||
|
||||
@ -44,7 +44,7 @@ class REST_Blocks_Controller_Test extends WP_UnitTestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Helper that lets us create fake data.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = wp_insert_post(
|
||||
array(
|
||||
'post_type' => 'wp_block',
|
||||
|
||||
@ -19,7 +19,7 @@ class WP_Test_REST_Categories_Controller extends WP_Test_REST_Controller_Testcas
|
||||
protected static $total_categories = 30;
|
||||
protected static $per_page = 50;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$administrator = $factory->user->create(
|
||||
array(
|
||||
'role' => 'administrator',
|
||||
|
||||
@ -31,7 +31,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
|
||||
protected $endpoint;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
add_role(
|
||||
'comment_moderator',
|
||||
'Comment Moderator',
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Testcase {
|
||||
protected static $editor_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$editor_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'editor',
|
||||
|
||||
@ -49,7 +49,7 @@ class WP_REST_Plugins_Controller_Test extends WP_Test_REST_Controller_Testcase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory WordPress unit test factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$subscriber_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'subscriber',
|
||||
|
||||
@ -14,7 +14,7 @@ class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase {
|
||||
protected static $post_id;
|
||||
protected static $cpt_post_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
register_post_type(
|
||||
'cpt',
|
||||
array(
|
||||
|
||||
@ -26,7 +26,7 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
|
||||
protected $forbidden_cat;
|
||||
protected $posts_clauses;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = $factory->post->create();
|
||||
|
||||
self::$superadmin_id = $factory->user->create(
|
||||
|
||||
@ -16,7 +16,7 @@ class WP_Test_REST_Revisions_Controller extends WP_Test_REST_Controller_Testcase
|
||||
protected static $editor_id;
|
||||
protected static $contributor_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$post_id = $factory->post->create();
|
||||
self::$page_id = $factory->post->create( array( 'post_type' => 'page' ) );
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ class WP_Test_REST_Search_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory Helper that lets us create fake data.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
add_theme_support( 'post-formats', array( 'aside' ) );
|
||||
|
||||
self::$my_title_post_ids = $factory->post->create_many(
|
||||
|
||||
@ -14,7 +14,7 @@ class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase
|
||||
protected static $administrator;
|
||||
protected static $author;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$administrator = $factory->user->create(
|
||||
array(
|
||||
'role' => 'administrator',
|
||||
|
||||
@ -39,7 +39,7 @@ class WP_Test_REST_Site_Health_Controller extends WP_Test_REST_TestCase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory WordPress unit test factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$subscriber = $factory->user->create(
|
||||
array(
|
||||
'role' => 'subscriber',
|
||||
|
||||
@ -20,7 +20,7 @@ class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
protected static $total_tags = 30;
|
||||
protected static $per_page = 50;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$superadmin = $factory->user->create(
|
||||
array(
|
||||
'role' => 'administrator',
|
||||
|
||||
@ -13,7 +13,7 @@ class WP_Test_REST_Taxonomies_Controller extends WP_Test_REST_Controller_Testcas
|
||||
|
||||
protected static $contributor_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$contributor_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'contributor',
|
||||
|
||||
@ -14,7 +14,7 @@ class WP_Test_REST_Term_Meta_Fields extends WP_Test_REST_TestCase {
|
||||
protected static $category_id;
|
||||
protected static $customtax_term_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
register_taxonomy(
|
||||
'customtax',
|
||||
'post',
|
||||
|
||||
@ -90,7 +90,7 @@ class WP_Test_REST_Themes_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
*
|
||||
* @param WP_UnitTest_Factory $factory WordPress unit test factory.
|
||||
*/
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$subscriber_id = $factory->user->create(
|
||||
array(
|
||||
'role' => 'subscriber',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user