diff --git a/tests/phpunit/includes/testcase-canonical.php b/tests/phpunit/includes/testcase-canonical.php index 3866145589..0de32472d2 100644 --- a/tests/phpunit/includes/testcase-canonical.php +++ b/tests/phpunit/includes/testcase-canonical.php @@ -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( diff --git a/tests/phpunit/tests/admin/includesComment.php b/tests/phpunit/tests/admin/includesComment.php index 1dcc6bb458..79f96afe24 100644 --- a/tests/phpunit/tests/admin/includesComment.php +++ b/tests/phpunit/tests/admin/includesComment.php @@ -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( diff --git a/tests/phpunit/tests/admin/includesListTable.php b/tests/phpunit/tests/admin/includesListTable.php index 22e5045372..d19c2c0e63 100644 --- a/tests/phpunit/tests/admin/includesListTable.php +++ b/tests/phpunit/tests/admin/includesListTable.php @@ -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. diff --git a/tests/phpunit/tests/admin/includesPost.php b/tests/phpunit/tests/admin/includesPost.php index fcb74ced2d..366bfefcd7 100644 --- a/tests/phpunit/tests/admin/includesPost.php +++ b/tests/phpunit/tests/admin/includesPost.php @@ -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; diff --git a/tests/phpunit/tests/admin/includesSchema.php b/tests/phpunit/tests/admin/includesSchema.php index d770128bf3..1ce0a95b2e 100644 --- a/tests/phpunit/tests/admin/includesSchema.php +++ b/tests/phpunit/tests/admin/includesSchema.php @@ -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'; diff --git a/tests/phpunit/tests/adminbar.php b/tests/phpunit/tests/adminbar.php index 760a1dec4c..1b54e5faf8 100644 --- a/tests/phpunit/tests/adminbar.php +++ b/tests/phpunit/tests/adminbar.php @@ -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' ) ); diff --git a/tests/phpunit/tests/ajax/Autosave.php b/tests/phpunit/tests/ajax/Autosave.php index 9e53284516..457bcc4c71 100644 --- a/tests/phpunit/tests/ajax/Autosave.php +++ b/tests/phpunit/tests/ajax/Autosave.php @@ -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' ) ); diff --git a/tests/phpunit/tests/ajax/CustomizeManager.php b/tests/phpunit/tests/ajax/CustomizeManager.php index 6955097a30..ab63bb65f0 100644 --- a/tests/phpunit/tests/ajax/CustomizeManager.php +++ b/tests/phpunit/tests/ajax/CustomizeManager.php @@ -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' ) ); } diff --git a/tests/phpunit/tests/ajax/DeleteComment.php b/tests/phpunit/tests/ajax/DeleteComment.php index 70076f001b..aa628221ac 100644 --- a/tests/phpunit/tests/ajax/DeleteComment.php +++ b/tests/phpunit/tests/ajax/DeleteComment.php @@ -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 ); diff --git a/tests/phpunit/tests/ajax/GetComments.php b/tests/phpunit/tests/ajax/GetComments.php index 582f5f38ba..6649e30dab 100644 --- a/tests/phpunit/tests/ajax/GetComments.php +++ b/tests/phpunit/tests/ajax/GetComments.php @@ -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(); diff --git a/tests/phpunit/tests/ajax/PrivacyErasePersonalData.php b/tests/phpunit/tests/ajax/PrivacyErasePersonalData.php index 36928f940d..dc13eea292 100644 --- a/tests/phpunit/tests/ajax/PrivacyErasePersonalData.php +++ b/tests/phpunit/tests/ajax/PrivacyErasePersonalData.php @@ -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'; diff --git a/tests/phpunit/tests/ajax/PrivacyExportPersonalData.php b/tests/phpunit/tests/ajax/PrivacyExportPersonalData.php index 9ba321e730..2c7ed7a62a 100644 --- a/tests/phpunit/tests/ajax/PrivacyExportPersonalData.php +++ b/tests/phpunit/tests/ajax/PrivacyExportPersonalData.php @@ -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'; diff --git a/tests/phpunit/tests/ajax/ReplytoComment.php b/tests/phpunit/tests/ajax/ReplytoComment.php index 3e638aa80c..dbc8b3bfef 100644 --- a/tests/phpunit/tests/ajax/ReplytoComment.php +++ b/tests/phpunit/tests/ajax/ReplytoComment.php @@ -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' ) ); diff --git a/tests/phpunit/tests/ajax/TagSearch.php b/tests/phpunit/tests/ajax/TagSearch.php index a92694f46d..971c8cb995 100644 --- a/tests/phpunit/tests/ajax/TagSearch.php +++ b/tests/phpunit/tests/ajax/TagSearch.php @@ -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' ); } diff --git a/tests/phpunit/tests/attachment/slashes.php b/tests/phpunit/tests/attachment/slashes.php index 8bd8a8290a..d5d5badfa5 100644 --- a/tests/phpunit/tests/attachment/slashes.php +++ b/tests/phpunit/tests/attachment/slashes.php @@ -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' ) ); } diff --git a/tests/phpunit/tests/auth.php b/tests/phpunit/tests/auth.php index 42cafa06d9..ffdb1426e9 100644 --- a/tests/phpunit/tests/auth.php +++ b/tests/phpunit/tests/auth.php @@ -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', diff --git a/tests/phpunit/tests/blocks/block-type.php b/tests/phpunit/tests/blocks/block-type.php index e93aed05a2..8f36a9bcf5 100644 --- a/tests/phpunit/tests/blocks/block-type.php +++ b/tests/phpunit/tests/blocks/block-type.php @@ -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' => "\n
Tester
\n", ) ); - self::$post_without_blocks = self::factory()->post->create( + self::$post_without_blocks = $factory->post->create( array( 'post_title' => 'Example', 'post_content' => 'Tester', diff --git a/tests/phpunit/tests/blocks/register.php b/tests/phpunit/tests/blocks/register.php index 5fb6e9e062..392f7e2977 100644 --- a/tests/phpunit/tests/blocks/register.php +++ b/tests/phpunit/tests/blocks/register.php @@ -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' ), diff --git a/tests/phpunit/tests/blocks/render-reusable.php b/tests/phpunit/tests/blocks/render-reusable.php index 7188e3a897..66b01b0428 100644 --- a/tests/phpunit/tests/blocks/render-reusable.php +++ b/tests/phpunit/tests/blocks/render-reusable.php @@ -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', diff --git a/tests/phpunit/tests/canonical/category.php b/tests/phpunit/tests/canonical/category.php index bbf2b3414d..a7923b573c 100644 --- a/tests/phpunit/tests/canonical/category.php +++ b/tests/phpunit/tests/canonical/category.php @@ -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' ) ); diff --git a/tests/phpunit/tests/canonical/postStatus.php b/tests/phpunit/tests/canonical/postStatus.php index 7660206b26..0df373a427 100644 --- a/tests/phpunit/tests/canonical/postStatus.php +++ b/tests/phpunit/tests/canonical/postStatus.php @@ -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, diff --git a/tests/phpunit/tests/comment-submission.php b/tests/phpunit/tests/comment-submission.php index 715783a3c1..56f06b8148 100644 --- a/tests/phpunit/tests/comment-submission.php +++ b/tests/phpunit/tests/comment-submission.php @@ -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( diff --git a/tests/phpunit/tests/comment.php b/tests/phpunit/tests/comment.php index 267aa29fec..c3013ad2c6 100644 --- a/tests/phpunit/tests/comment.php +++ b/tests/phpunit/tests/comment.php @@ -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', diff --git a/tests/phpunit/tests/comment/getCommentAuthorEmailLink.php b/tests/phpunit/tests/comment/getCommentAuthorEmailLink.php index 07d01f00e2..245f3df79c 100644 --- a/tests/phpunit/tests/comment/getCommentAuthorEmailLink.php +++ b/tests/phpunit/tests/comment/getCommentAuthorEmailLink.php @@ -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', diff --git a/tests/phpunit/tests/comment/getCommentAuthorUrlLink.php b/tests/phpunit/tests/comment/getCommentAuthorUrlLink.php index 4a7457c2fe..6fd82cb796 100644 --- a/tests/phpunit/tests/comment/getCommentAuthorUrlLink.php +++ b/tests/phpunit/tests/comment/getCommentAuthorUrlLink.php @@ -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 ); diff --git a/tests/phpunit/tests/comment/getCommentLink.php b/tests/phpunit/tests/comment/getCommentLink.php index 03ccf923ab..39551e0aa2 100644 --- a/tests/phpunit/tests/comment/getCommentLink.php +++ b/tests/phpunit/tests/comment/getCommentLink.php @@ -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', diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index c6b3079703..0a8a5ab6d7 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -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(); } diff --git a/tests/phpunit/tests/comment/slashes.php b/tests/phpunit/tests/comment/slashes.php index ed6f2834f7..d2f7d73ca0 100644 --- a/tests/phpunit/tests/comment/slashes.php +++ b/tests/phpunit/tests/comment/slashes.php @@ -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(); diff --git a/tests/phpunit/tests/comment/wpAllowComment.php b/tests/phpunit/tests/comment/wpAllowComment.php index 07e66d4f56..c7c32758b6 100644 --- a/tests/phpunit/tests/comment/wpAllowComment.php +++ b/tests/phpunit/tests/comment/wpAllowComment.php @@ -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( diff --git a/tests/phpunit/tests/comment/wpComment.php b/tests/phpunit/tests/comment/wpComment.php index 853d3a01d3..9e0dec75e4 100644 --- a/tests/phpunit/tests/comment/wpComment.php +++ b/tests/phpunit/tests/comment/wpComment.php @@ -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(); } /** diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index 520e6683fd..379f955d93 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -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' ) ); } diff --git a/tests/phpunit/tests/customize/section.php b/tests/phpunit/tests/customize/section.php index 92d818fd7e..f48ca03b4b 100644 --- a/tests/phpunit/tests/customize/section.php +++ b/tests/phpunit/tests/customize/section.php @@ -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; } diff --git a/tests/phpunit/tests/feed/atom.php b/tests/phpunit/tests/feed/atom.php index e8d308014c..88140ded96 100644 --- a/tests/phpunit/tests/feed/atom.php +++ b/tests/phpunit/tests/feed/atom.php @@ -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( diff --git a/tests/phpunit/tests/feed/rss2.php b/tests/phpunit/tests/feed/rss2.php index 16fd4fe198..e65b6f126a 100644 --- a/tests/phpunit/tests/feed/rss2.php +++ b/tests/phpunit/tests/feed/rss2.php @@ -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( diff --git a/tests/phpunit/tests/functions/wpGetArchives.php b/tests/phpunit/tests/functions/wpGetArchives.php index ec983abe7a..369a909ca2 100644 --- a/tests/phpunit/tests/functions/wpGetArchives.php +++ b/tests/phpunit/tests/functions/wpGetArchives.php @@ -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( diff --git a/tests/phpunit/tests/l10n/loadTextdomain.php b/tests/phpunit/tests/l10n/loadTextdomain.php index b905ceb036..ee3c449668 100644 --- a/tests/phpunit/tests/l10n/loadTextdomain.php +++ b/tests/phpunit/tests/l10n/loadTextdomain.php @@ -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', diff --git a/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php b/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php index e0aa3df644..fa3e1589a1 100644 --- a/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php +++ b/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php @@ -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', diff --git a/tests/phpunit/tests/link/getDashboardUrl.php b/tests/phpunit/tests/link/getDashboardUrl.php index 9495c6f546..193039eccc 100644 --- a/tests/phpunit/tests/link/getDashboardUrl.php +++ b/tests/phpunit/tests/link/getDashboardUrl.php @@ -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' ) ); } diff --git a/tests/phpunit/tests/link/getThePrivacyPolicyLink.php b/tests/phpunit/tests/link/getThePrivacyPolicyLink.php index 15f6e6ccbe..36e9ccd577 100644 --- a/tests/phpunit/tests/link/getThePrivacyPolicyLink.php +++ b/tests/phpunit/tests/link/getThePrivacyPolicyLink.php @@ -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', diff --git a/tests/phpunit/tests/link/wpGetCanonicalURL.php b/tests/phpunit/tests/link/wpGetCanonicalURL.php index c6f0722db6..24f4999d08 100644 --- a/tests/phpunit/tests/link/wpGetCanonicalURL.php +++ b/tests/phpunit/tests/link/wpGetCanonicalURL.php @@ -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 Page 2 Page 3', diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 053ac5008d..8379bcb9ad 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -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(); diff --git a/tests/phpunit/tests/meta/registerMeta.php b/tests/phpunit/tests/meta/registerMeta.php index 22c282c437..720f4deaef 100644 --- a/tests/phpunit/tests/meta/registerMeta.php +++ b/tests/phpunit/tests/meta/registerMeta.php @@ -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(); diff --git a/tests/phpunit/tests/meta/slashes.php b/tests/phpunit/tests/meta/slashes.php index 6ef581ba2d..54393ebfa7 100644 --- a/tests/phpunit/tests/meta/slashes.php +++ b/tests/phpunit/tests/meta/slashes.php @@ -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 ) ); diff --git a/tests/phpunit/tests/multisite/bootstrap.php b/tests/phpunit/tests/multisite/bootstrap.php index eabf78297b..1439605169 100644 --- a/tests/phpunit/tests/multisite/bootstrap.php +++ b/tests/phpunit/tests/multisite/bootstrap.php @@ -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', diff --git a/tests/phpunit/tests/multisite/getBlogDetails.php b/tests/phpunit/tests/multisite/getBlogDetails.php index d0c4b81dce..358499e55a 100644 --- a/tests/phpunit/tests/multisite/getBlogDetails.php +++ b/tests/phpunit/tests/multisite/getBlogDetails.php @@ -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, diff --git a/tests/phpunit/tests/multisite/getIdFromBlogname.php b/tests/phpunit/tests/multisite/getIdFromBlogname.php index 3df68afe86..29d7c8c761 100644 --- a/tests/phpunit/tests/multisite/getIdFromBlogname.php +++ b/tests/phpunit/tests/multisite/getIdFromBlogname.php @@ -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', diff --git a/tests/phpunit/tests/multisite/getMainSiteId.php b/tests/phpunit/tests/multisite/getMainSiteId.php index 3d0148611f..63e68ef163 100644 --- a/tests/phpunit/tests/multisite/getMainSiteId.php +++ b/tests/phpunit/tests/multisite/getMainSiteId.php @@ -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', diff --git a/tests/phpunit/tests/multisite/getSite.php b/tests/phpunit/tests/multisite/getSite.php index 1df45df9be..f1c4779d6b 100644 --- a/tests/phpunit/tests/multisite/getSite.php +++ b/tests/phpunit/tests/multisite/getSite.php @@ -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', diff --git a/tests/phpunit/tests/multisite/network.php b/tests/phpunit/tests/multisite/network.php index ff7a2ff4b5..3742baf959 100644 --- a/tests/phpunit/tests/multisite/network.php +++ b/tests/phpunit/tests/multisite/network.php @@ -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', diff --git a/tests/phpunit/tests/multisite/networkQuery.php b/tests/phpunit/tests/multisite/networkQuery.php index 291d15eadc..fe82374a02 100644 --- a/tests/phpunit/tests/multisite/networkQuery.php +++ b/tests/phpunit/tests/multisite/networkQuery.php @@ -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', diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php index 5fe48265cf..cdff67e927 100644 --- a/tests/phpunit/tests/multisite/site.php +++ b/tests/phpunit/tests/multisite/site.php @@ -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', diff --git a/tests/phpunit/tests/multisite/siteMeta.php b/tests/phpunit/tests/multisite/siteMeta.php index 8ea6cddeeb..ed7ccfdec2 100644 --- a/tests/phpunit/tests/multisite/siteMeta.php +++ b/tests/phpunit/tests/multisite/siteMeta.php @@ -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', diff --git a/tests/phpunit/tests/multisite/siteQuery.php b/tests/phpunit/tests/multisite/siteQuery.php index 781b8d413a..ef639f680b 100644 --- a/tests/phpunit/tests/multisite/siteQuery.php +++ b/tests/phpunit/tests/multisite/siteQuery.php @@ -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', diff --git a/tests/phpunit/tests/multisite/wpGetSites.php b/tests/phpunit/tests/multisite/wpGetSites.php index 700b8d21c1..163a4714dd 100644 --- a/tests/phpunit/tests/multisite/wpGetSites.php +++ b/tests/phpunit/tests/multisite/wpGetSites.php @@ -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', diff --git a/tests/phpunit/tests/multisite/wpMSSitesListTable.php b/tests/phpunit/tests/multisite/wpMSSitesListTable.php index b9dc73cdb0..6fd22ab214 100644 --- a/tests/phpunit/tests/multisite/wpMSSitesListTable.php +++ b/tests/phpunit/tests/multisite/wpMSSitesListTable.php @@ -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', diff --git a/tests/phpunit/tests/multisite/wpmuValidateBlogSignup.php b/tests/phpunit/tests/multisite/wpmuValidateBlogSignup.php index 42e77a128c..576822c12f 100644 --- a/tests/phpunit/tests/multisite/wpmuValidateBlogSignup.php +++ b/tests/phpunit/tests/multisite/wpmuValidateBlogSignup.php @@ -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 ); diff --git a/tests/phpunit/tests/oembed/controller.php b/tests/phpunit/tests/oembed/controller.php index 3facaf0c97..731955f31d 100644 --- a/tests/phpunit/tests/oembed/controller.php +++ b/tests/phpunit/tests/oembed/controller.php @@ -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', diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php index 53e82f62a4..effd32eba3 100644 --- a/tests/phpunit/tests/post.php +++ b/tests/phpunit/tests/post.php @@ -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( diff --git a/tests/phpunit/tests/post/meta.php b/tests/phpunit/tests/post/meta.php index 369deef954..5b338325c0 100644 --- a/tests/phpunit/tests/post/meta.php +++ b/tests/phpunit/tests/post/meta.php @@ -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( diff --git a/tests/phpunit/tests/post/revisions.php b/tests/phpunit/tests/post/revisions.php index 5e028a304b..95efe83578 100644 --- a/tests/phpunit/tests/post/revisions.php +++ b/tests/phpunit/tests/post/revisions.php @@ -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' ) ); diff --git a/tests/phpunit/tests/post/slashes.php b/tests/phpunit/tests/post/slashes.php index d2622c4d80..a1bb11577d 100644 --- a/tests/phpunit/tests/post/slashes.php +++ b/tests/phpunit/tests/post/slashes.php @@ -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(); } diff --git a/tests/phpunit/tests/post/thumbnails.php b/tests/phpunit/tests/post/thumbnails.php index 36a386d9bd..f5fce8ac44 100644 --- a/tests/phpunit/tests/post/thumbnails.php +++ b/tests/phpunit/tests/post/thumbnails.php @@ -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(); diff --git a/tests/phpunit/tests/post/wpGetPostParentId.php b/tests/phpunit/tests/post/wpGetPostParentId.php index 7080abbd6d..bd25232830 100644 --- a/tests/phpunit/tests/post/wpGetPostParentId.php +++ b/tests/phpunit/tests/post/wpGetPostParentId.php @@ -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() { diff --git a/tests/phpunit/tests/post/wpInsertPost.php b/tests/phpunit/tests/post/wpInsertPost.php index 7fb706d00e..d43d9ba864 100644 --- a/tests/phpunit/tests/post/wpInsertPost.php +++ b/tests/phpunit/tests/post/wpInsertPost.php @@ -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( diff --git a/tests/phpunit/tests/post/wpListPages.php b/tests/phpunit/tests/post/wpListPages.php index 880c63ff9d..80cb68658a 100644 --- a/tests/phpunit/tests/post/wpListPages.php +++ b/tests/phpunit/tests/post/wpListPages.php @@ -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', diff --git a/tests/phpunit/tests/post/wpPost.php b/tests/phpunit/tests/post/wpPost.php index 801b2dc77d..58a7f758e7 100644 --- a/tests/phpunit/tests/post/wpPost.php +++ b/tests/phpunit/tests/post/wpPost.php @@ -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(); } /** diff --git a/tests/phpunit/tests/post/wpPublishPost.php b/tests/phpunit/tests/post/wpPublishPost.php index a5d9cc980f..e8514cde3e 100644 --- a/tests/phpunit/tests/post/wpPublishPost.php +++ b/tests/phpunit/tests/post/wpPublishPost.php @@ -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' ) ); } diff --git a/tests/phpunit/tests/privacy/wpCreateUserRequest.php b/tests/phpunit/tests/privacy/wpCreateUserRequest.php index 3df2e35156..479aadca3c 100644 --- a/tests/phpunit/tests/privacy/wpCreateUserRequest.php +++ b/tests/phpunit/tests/privacy/wpCreateUserRequest.php @@ -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'; diff --git a/tests/phpunit/tests/privacy/wpPrivacyCompletedRequest.php b/tests/phpunit/tests/privacy/wpPrivacyCompletedRequest.php index b3d45a9c89..6455379a4b 100644 --- a/tests/phpunit/tests/privacy/wpPrivacyCompletedRequest.php +++ b/tests/phpunit/tests/privacy/wpPrivacyCompletedRequest.php @@ -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' ); } diff --git a/tests/phpunit/tests/privacy/wpPrivacyDeleteOldExportFiles.php b/tests/phpunit/tests/privacy/wpPrivacyDeleteOldExportFiles.php index 69b0dc129a..37d55dbadd 100644 --- a/tests/phpunit/tests/privacy/wpPrivacyDeleteOldExportFiles.php +++ b/tests/phpunit/tests/privacy/wpPrivacyDeleteOldExportFiles.php @@ -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 ) ) { diff --git a/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php b/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php index 2288124c84..2aaa0bab02 100644 --- a/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php +++ b/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php @@ -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(); diff --git a/tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php b/tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php index 08b5f21de6..fd20c51de4 100644 --- a/tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php +++ b/tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php @@ -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'; diff --git a/tests/phpunit/tests/privacy/wpPrivacySendErasureFulfillmentNotification.php b/tests/phpunit/tests/privacy/wpPrivacySendErasureFulfillmentNotification.php index a30b73f6d9..28708ad7c5 100644 --- a/tests/phpunit/tests/privacy/wpPrivacySendErasureFulfillmentNotification.php +++ b/tests/phpunit/tests/privacy/wpPrivacySendErasureFulfillmentNotification.php @@ -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( diff --git a/tests/phpunit/tests/privacy/wpPrivacySendPersonalDataExportEmail.php b/tests/phpunit/tests/privacy/wpPrivacySendPersonalDataExportEmail.php index 54c775ae49..a2e62908e2 100644 --- a/tests/phpunit/tests/privacy/wpPrivacySendPersonalDataExportEmail.php +++ b/tests/phpunit/tests/privacy/wpPrivacySendPersonalDataExportEmail.php @@ -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( diff --git a/tests/phpunit/tests/query/commentCount.php b/tests/phpunit/tests/query/commentCount.php index 29d3f3cad6..fb1bb56e45 100644 --- a/tests/phpunit/tests/query/commentCount.php +++ b/tests/phpunit/tests/query/commentCount.php @@ -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 ) ); } } diff --git a/tests/phpunit/tests/query/date.php b/tests/phpunit/tests/query/date.php index 17d5dc5aa3..873509f96c 100644 --- a/tests/phpunit/tests/query/date.php +++ b/tests/phpunit/tests/query/date.php @@ -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', diff --git a/tests/phpunit/tests/query/postStatus.php b/tests/phpunit/tests/query/postStatus.php index c0be8b01e4..7d4a236b50 100644 --- a/tests/phpunit/tests/query/postStatus.php +++ b/tests/phpunit/tests/query/postStatus.php @@ -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' ) ); diff --git a/tests/phpunit/tests/query/results.php b/tests/phpunit/tests/query/results.php index e284e3417b..80bfc5e379 100644 --- a/tests/phpunit/tests/query/results.php +++ b/tests/phpunit/tests/query/results.php @@ -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', diff --git a/tests/phpunit/tests/query/stickies.php b/tests/phpunit/tests/query/stickies.php index 306c1a6876..e6d9d41f40 100644 --- a/tests/phpunit/tests/query/stickies.php +++ b/tests/phpunit/tests/query/stickies.php @@ -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++ ) { diff --git a/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php b/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php index 3cf3d0e42e..e076566afa 100644 --- a/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php +++ b/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-attachments-controller.php b/tests/phpunit/tests/rest-api/rest-attachments-controller.php index 6cd0f5eb10..ec560e9c00 100644 --- a/tests/phpunit/tests/rest-api/rest-attachments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-attachments-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-autosaves-controller.php b/tests/phpunit/tests/rest-api/rest-autosaves-controller.php index e5ec08f66e..609fbb73c9 100644 --- a/tests/phpunit/tests/rest-api/rest-autosaves-controller.php +++ b/tests/phpunit/tests/rest-api/rest-autosaves-controller.php @@ -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' ) ); diff --git a/tests/phpunit/tests/rest-api/rest-block-directory-controller.php b/tests/phpunit/tests/rest-api/rest-block-directory-controller.php index 940040e723..122c44e3e2 100644 --- a/tests/phpunit/tests/rest-api/rest-block-directory-controller.php +++ b/tests/phpunit/tests/rest-api/rest-block-directory-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php b/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php index 0e8dddc25a..5106d0d502 100644 --- a/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php +++ b/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-block-type-controller.php b/tests/phpunit/tests/rest-api/rest-block-type-controller.php index 06db6d9675..7bd1712f94 100644 --- a/tests/phpunit/tests/rest-api/rest-block-type-controller.php +++ b/tests/phpunit/tests/rest-api/rest-block-type-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-blocks-controller.php b/tests/phpunit/tests/rest-api/rest-blocks-controller.php index e5fbb33302..c3e0a9fb75 100644 --- a/tests/phpunit/tests/rest-api/rest-blocks-controller.php +++ b/tests/phpunit/tests/rest-api/rest-blocks-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-categories-controller.php b/tests/phpunit/tests/rest-api/rest-categories-controller.php index 2899602451..99beabbc5e 100644 --- a/tests/phpunit/tests/rest-api/rest-categories-controller.php +++ b/tests/phpunit/tests/rest-api/rest-categories-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php index 479ffeca88..5451e12533 100644 --- a/tests/phpunit/tests/rest-api/rest-comments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-comments-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-pages-controller.php b/tests/phpunit/tests/rest-api/rest-pages-controller.php index 768a0f03b6..1180fed889 100644 --- a/tests/phpunit/tests/rest-api/rest-pages-controller.php +++ b/tests/phpunit/tests/rest-api/rest-pages-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-plugins-controller.php b/tests/phpunit/tests/rest-api/rest-plugins-controller.php index 22b2f0a40c..aff8ffa3eb 100644 --- a/tests/phpunit/tests/rest-api/rest-plugins-controller.php +++ b/tests/phpunit/tests/rest-api/rest-plugins-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php index d326b5fb9d..e3fc92d761 100644 --- a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php +++ b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php @@ -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( diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php index eca29aba89..d07347f973 100644 --- a/tests/phpunit/tests/rest-api/rest-posts-controller.php +++ b/tests/phpunit/tests/rest-api/rest-posts-controller.php @@ -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( diff --git a/tests/phpunit/tests/rest-api/rest-revisions-controller.php b/tests/phpunit/tests/rest-api/rest-revisions-controller.php index 8a7ad9fbfa..a1e982b8be 100644 --- a/tests/phpunit/tests/rest-api/rest-revisions-controller.php +++ b/tests/phpunit/tests/rest-api/rest-revisions-controller.php @@ -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' ) ); diff --git a/tests/phpunit/tests/rest-api/rest-search-controller.php b/tests/phpunit/tests/rest-api/rest-search-controller.php index ae7546771c..931cf8fb51 100644 --- a/tests/phpunit/tests/rest-api/rest-search-controller.php +++ b/tests/phpunit/tests/rest-api/rest-search-controller.php @@ -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( diff --git a/tests/phpunit/tests/rest-api/rest-settings-controller.php b/tests/phpunit/tests/rest-api/rest-settings-controller.php index 1466a93f6e..c9aab41f74 100644 --- a/tests/phpunit/tests/rest-api/rest-settings-controller.php +++ b/tests/phpunit/tests/rest-api/rest-settings-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-site-health-controller.php b/tests/phpunit/tests/rest-api/rest-site-health-controller.php index 7a8c907dfe..46f47de091 100644 --- a/tests/phpunit/tests/rest-api/rest-site-health-controller.php +++ b/tests/phpunit/tests/rest-api/rest-site-health-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-tags-controller.php b/tests/phpunit/tests/rest-api/rest-tags-controller.php index bae98da827..72c2df455e 100644 --- a/tests/phpunit/tests/rest-api/rest-tags-controller.php +++ b/tests/phpunit/tests/rest-api/rest-tags-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php b/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php index 14c3c955d8..d8cf72768b 100644 --- a/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php +++ b/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-term-meta-fields.php b/tests/phpunit/tests/rest-api/rest-term-meta-fields.php index 97dd6048fe..6c8f3a0135 100644 --- a/tests/phpunit/tests/rest-api/rest-term-meta-fields.php +++ b/tests/phpunit/tests/rest-api/rest-term-meta-fields.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-themes-controller.php b/tests/phpunit/tests/rest-api/rest-themes-controller.php index 1689879845..1d472ce13c 100644 --- a/tests/phpunit/tests/rest-api/rest-themes-controller.php +++ b/tests/phpunit/tests/rest-api/rest-themes-controller.php @@ -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', diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php index bf8adbf671..7897d10d1d 100644 --- a/tests/phpunit/tests/rest-api/rest-users-controller.php +++ b/tests/phpunit/tests/rest-api/rest-users-controller.php @@ -24,7 +24,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { protected static $site; - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$superadmin = $factory->user->create( array( 'role' => 'administrator', diff --git a/tests/phpunit/tests/rewrite/addRewriteEndpoint.php b/tests/phpunit/tests/rewrite/addRewriteEndpoint.php index 20711aba35..149566b669 100644 --- a/tests/phpunit/tests/rewrite/addRewriteEndpoint.php +++ b/tests/phpunit/tests/rewrite/addRewriteEndpoint.php @@ -8,7 +8,7 @@ class Tests_Rewrite_AddRewriteEndpoint extends WP_UnitTestCase { protected static $test_page_id; protected static $test_post_id; - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$test_page_id = $factory->post->create( array( 'post_type' => 'page', diff --git a/tests/phpunit/tests/rewrite/oldDateRedirect.php b/tests/phpunit/tests/rewrite/oldDateRedirect.php index 39303a9e32..c0b50a2dbd 100644 --- a/tests/phpunit/tests/rewrite/oldDateRedirect.php +++ b/tests/phpunit/tests/rewrite/oldDateRedirect.php @@ -10,15 +10,15 @@ class Tests_Rewrite_OldDateRedirect extends WP_UnitTestCase { public static $attachment_id; - public static function wpSetUpBeforeClass() { - self::$post_id = self::factory()->post->create( + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { + self::$post_id = $factory->post->create( array( 'post_title' => 'Foo Bar', 'post_name' => 'foo-bar', ) ); - self::$attachment_id = self::factory()->attachment->create_object( + self::$attachment_id = $factory->attachment->create_object( array( 'file' => DIR_TESTDATA . '/images/canola.jpg', 'post_mime_type' => 'image/jpeg', diff --git a/tests/phpunit/tests/site-health.php b/tests/phpunit/tests/site-health.php index 75f1045562..cdb38186d3 100644 --- a/tests/phpunit/tests/site-health.php +++ b/tests/phpunit/tests/site-health.php @@ -4,7 +4,7 @@ * @group site-health */ class Tests_Site_Health extends WP_UnitTestCase { - public static function wpSetUpBeforeClass() { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { // Include the `WP_Site_Health` file. require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; } diff --git a/tests/phpunit/tests/sitemaps/sitemaps-taxonomies.php b/tests/phpunit/tests/sitemaps/sitemaps-taxonomies.php index 578e637f26..e98c6b71ee 100644 --- a/tests/phpunit/tests/sitemaps/sitemaps-taxonomies.php +++ b/tests/phpunit/tests/sitemaps/sitemaps-taxonomies.php @@ -30,7 +30,7 @@ class Test_WP_Sitemaps_Taxonomies extends WP_UnitTestCase { * * @param WP_UnitTest_Factory $factory A WP_UnitTest_Factory object. */ - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$cats = $factory->term->create_many( 10, array( 'taxonomy' => 'category' ) ); self::$post_tags = $factory->term->create_many( 10 ); self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); diff --git a/tests/phpunit/tests/sitemaps/sitemaps-users.php b/tests/phpunit/tests/sitemaps/sitemaps-users.php index 6e625f5fcc..3cd76d3376 100644 --- a/tests/phpunit/tests/sitemaps/sitemaps-users.php +++ b/tests/phpunit/tests/sitemaps/sitemaps-users.php @@ -23,7 +23,7 @@ class Test_WP_Sitemaps_Users extends WP_UnitTestCase { * * @param WP_UnitTest_Factory $factory A WP_UnitTest_Factory object. */ - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$users = $factory->user->create_many( 10, array( 'role' => 'editor' ) ); self::$editor_id = self::$users[0]; } diff --git a/tests/phpunit/tests/sitemaps/sitemaps.php b/tests/phpunit/tests/sitemaps/sitemaps.php index 1ce512c6ac..da47954e8e 100644 --- a/tests/phpunit/tests/sitemaps/sitemaps.php +++ b/tests/phpunit/tests/sitemaps/sitemaps.php @@ -71,7 +71,7 @@ class Test_Sitemaps extends WP_UnitTestCase { * * @param WP_UnitTest_Factory $factory A WP_UnitTest_Factory object. */ - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$users = $factory->user->create_many( 10 ); self::$post_tags = $factory->term->create_many( 10 ); self::$cats = $factory->term->create_many( 10, array( 'taxonomy' => 'category' ) ); diff --git a/tests/phpunit/tests/term.php b/tests/phpunit/tests/term.php index 9454bd0e87..4808e47d72 100644 --- a/tests/phpunit/tests/term.php +++ b/tests/phpunit/tests/term.php @@ -7,7 +7,7 @@ class Tests_Term extends WP_UnitTestCase { protected $taxonomy = 'category'; protected static $post_ids = array(); - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$post_ids = $factory->post->create_many( 5 ); } diff --git a/tests/phpunit/tests/term/getTermParentsList.php b/tests/phpunit/tests/term/getTermParentsList.php index 8d660bbb50..923571cfcb 100644 --- a/tests/phpunit/tests/term/getTermParentsList.php +++ b/tests/phpunit/tests/term/getTermParentsList.php @@ -7,7 +7,7 @@ class Tests_Terms_GetTermsParentsList extends WP_UnitTestCase { protected static $c1; protected static $c2; - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); self::$c1 = $factory->term->create_and_get( array( 'taxonomy' => 'wptests_tax' ) ); diff --git a/tests/phpunit/tests/term/getTheTerms.php b/tests/phpunit/tests/term/getTheTerms.php index af59c1b752..a28411405a 100644 --- a/tests/phpunit/tests/term/getTheTerms.php +++ b/tests/phpunit/tests/term/getTheTerms.php @@ -7,7 +7,7 @@ class Tests_Term_GetTheTerms extends WP_UnitTestCase { protected $taxonomy = 'category'; protected static $post_ids = array(); - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$post_ids = $factory->post->create_many( 5 ); } diff --git a/tests/phpunit/tests/term/slashes.php b/tests/phpunit/tests/term/slashes.php index bc114c16d9..fa1ef30c20 100644 --- a/tests/phpunit/tests/term/slashes.php +++ b/tests/phpunit/tests/term/slashes.php @@ -8,7 +8,7 @@ class Tests_Term_Slashes extends WP_Ajax_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' => 'administrator' ) ); } diff --git a/tests/phpunit/tests/term/termCounts.php b/tests/phpunit/tests/term/termCounts.php index ccb3da8a41..c6fa42e4fc 100644 --- a/tests/phpunit/tests/term/termCounts.php +++ b/tests/phpunit/tests/term/termCounts.php @@ -45,7 +45,7 @@ class Tests_Term_termCount extends WP_UnitTestCase { * * @param WP_UnitTest_Factory $factory Test suite factory. */ - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { $statuses = array( 'publish', 'auto-draft', 'draft', 'private' ); foreach ( $statuses as $status ) { self::$post_ids[ $status ] = $factory->post->create( array( 'post_status' => $status ) ); diff --git a/tests/phpunit/tests/term/wpSetObjectTerms.php b/tests/phpunit/tests/term/wpSetObjectTerms.php index 774842f1c3..df35ab1783 100644 --- a/tests/phpunit/tests/term/wpSetObjectTerms.php +++ b/tests/phpunit/tests/term/wpSetObjectTerms.php @@ -7,7 +7,7 @@ class Tests_Term_WpSetObjectTerms extends WP_UnitTestCase { protected $taxonomy = 'category'; protected static $post_ids = array(); - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$post_ids = $factory->post->create_many( 5 ); } diff --git a/tests/phpunit/tests/term/wpTerm.php b/tests/phpunit/tests/term/wpTerm.php index 1c74cb65cb..9c6a832cb7 100644 --- a/tests/phpunit/tests/term/wpTerm.php +++ b/tests/phpunit/tests/term/wpTerm.php @@ -11,7 +11,7 @@ class Tests_Term_WpTerm extends WP_UnitTestCase { register_taxonomy( 'wptests_tax', 'post' ); } - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { global $wpdb; register_taxonomy( 'wptests_tax', 'post' ); @@ -36,7 +36,7 @@ class Tests_Term_WpTerm extends WP_UnitTestCase { clean_term_cache( 1, 'wptests_tax' ); } - self::$term_id = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); + self::$term_id = $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); } /** diff --git a/tests/phpunit/tests/theme/customHeader.php b/tests/phpunit/tests/theme/customHeader.php index 34a30496e9..cab863a563 100644 --- a/tests/phpunit/tests/theme/customHeader.php +++ b/tests/phpunit/tests/theme/customHeader.php @@ -8,7 +8,7 @@ class Tests_Theme_Custom_Header extends WP_UnitTestCase { protected static $header_video_id; - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$post = self::factory()->post->create( array( 'post_status' => 'publish', diff --git a/tests/phpunit/tests/url/getPrivacyPolicyUrl.php b/tests/phpunit/tests/url/getPrivacyPolicyUrl.php index 67d10a6a3d..7c06cf4fda 100644 --- a/tests/phpunit/tests/url/getPrivacyPolicyUrl.php +++ b/tests/phpunit/tests/url/getPrivacyPolicyUrl.php @@ -38,7 +38,7 @@ class Tests_Url_GetPrivacyPolicyUrl 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', diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php index 11c9d76d93..4cc7c1fb91 100644 --- a/tests/phpunit/tests/user.php +++ b/tests/phpunit/tests/user.php @@ -18,7 +18,7 @@ class Tests_User extends WP_UnitTestCase { protected $author; protected $user_data; - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$contrib_id = $factory->user->create( array( 'user_login' => 'user1', diff --git a/tests/phpunit/tests/user/capabilities.php b/tests/phpunit/tests/user/capabilities.php index 11d0e2ace8..b2d667b505 100644 --- a/tests/phpunit/tests/user/capabilities.php +++ b/tests/phpunit/tests/user/capabilities.php @@ -19,7 +19,7 @@ class Tests_User_Capabilities extends WP_UnitTestCase { protected static $block_id; - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$users = array( 'administrator' => $factory->user->create_and_get( array( 'role' => 'administrator' ) ), 'editor' => $factory->user->create_and_get( array( 'role' => 'editor' ) ), diff --git a/tests/phpunit/tests/user/countUserPosts.php b/tests/phpunit/tests/user/countUserPosts.php index 3ddd3b4da0..7c6886dd0c 100644 --- a/tests/phpunit/tests/user/countUserPosts.php +++ b/tests/phpunit/tests/user/countUserPosts.php @@ -8,7 +8,7 @@ class Tests_User_CountUserPosts extends WP_UnitTestCase { public static $user_id; public static $post_ids = array(); - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$user_id = $factory->user->create( array( 'role' => 'author', diff --git a/tests/phpunit/tests/user/getActiveBlogForUser.php b/tests/phpunit/tests/user/getActiveBlogForUser.php index 6476e3ac63..2abb726e2f 100644 --- a/tests/phpunit/tests/user/getActiveBlogForUser.php +++ b/tests/phpunit/tests/user/getActiveBlogForUser.php @@ -12,7 +12,7 @@ if ( is_multisite() ) : class Tests_Multisite_getActiveBlogForUser 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(); } diff --git a/tests/phpunit/tests/user/listAuthors.php b/tests/phpunit/tests/user/listAuthors.php index 35c3e91211..cc6d75dcc8 100644 --- a/tests/phpunit/tests/user/listAuthors.php +++ b/tests/phpunit/tests/user/listAuthors.php @@ -23,7 +23,7 @@ class Tests_User_ListAuthors extends WP_UnitTestCase { 'style' => 'list', 'html' => true ); */ - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$user_ids[] = $factory->user->create( array( 'user_login' => 'zack', diff --git a/tests/phpunit/tests/user/mapMetaCap.php b/tests/phpunit/tests/user/mapMetaCap.php index 9223a57d8d..5a18a8bbaa 100644 --- a/tests/phpunit/tests/user/mapMetaCap.php +++ b/tests/phpunit/tests/user/mapMetaCap.php @@ -13,8 +13,8 @@ class Tests_User_MapMetaCap extends WP_UnitTestCase { protected static $post_id = null; public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { - self::$user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); - self::$author_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); + self::$user_id = $factory->user->create( array( 'role' => 'administrator' ) ); + self::$author_id = $factory->user->create( array( 'role' => 'administrator' ) ); if ( isset( $GLOBALS['super_admins'] ) ) { self::$super_admins = $GLOBALS['super_admins']; diff --git a/tests/phpunit/tests/user/query.php b/tests/phpunit/tests/user/query.php index d2a732db46..8db016b6de 100644 --- a/tests/phpunit/tests/user/query.php +++ b/tests/phpunit/tests/user/query.php @@ -13,7 +13,7 @@ class Tests_User_Query extends WP_UnitTestCase { protected $user_id; - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$author_ids = $factory->user->create_many( 4, array( diff --git a/tests/phpunit/tests/user/slashes.php b/tests/phpunit/tests/user/slashes.php index 5e2722ae0b..d5d0fe20b8 100644 --- a/tests/phpunit/tests/user/slashes.php +++ b/tests/phpunit/tests/user/slashes.php @@ -9,7 +9,7 @@ class Tests_User_Slashes extends WP_UnitTestCase { protected static $author_id; protected static $user_id; - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$author_id = $factory->user->create( array( 'role' => 'administrator' ) ); self::$user_id = $factory->user->create(); } diff --git a/tests/phpunit/tests/user/wpSendUserRequest.php b/tests/phpunit/tests/user/wpSendUserRequest.php index 7f87cb8897..7a8ea6bbd7 100644 --- a/tests/phpunit/tests/user/wpSendUserRequest.php +++ b/tests/phpunit/tests/user/wpSendUserRequest.php @@ -42,7 +42,7 @@ class Tests_User_WpSendUserRequest extends WP_UnitTestCase { * * @param WP_UnitTest_Factory $factory Test fixture factory. */ - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$admin_user = $factory->user->create_and_get( array( 'user_email' => 'admin@local.dev', diff --git a/tests/phpunit/tests/user/wpSetCurrentUser.php b/tests/phpunit/tests/user/wpSetCurrentUser.php index b14a1c0d3d..b451a5298b 100644 --- a/tests/phpunit/tests/user/wpSetCurrentUser.php +++ b/tests/phpunit/tests/user/wpSetCurrentUser.php @@ -8,7 +8,7 @@ class Tests_User_WpSetCurrentUser extends WP_UnitTestCase { protected static $user_id2; protected static $user_ids = array(); - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$user_id = $factory->user->create(); self::$user_ids[] = self::$user_id; self::$user_id2 = $factory->user->create( array( 'user_login' => 'foo' ) ); diff --git a/tests/phpunit/tests/xmlrpc/wp/newComment.php b/tests/phpunit/tests/xmlrpc/wp/newComment.php index 08668cb320..85e637a540 100644 --- a/tests/phpunit/tests/xmlrpc/wp/newComment.php +++ b/tests/phpunit/tests/xmlrpc/wp/newComment.php @@ -21,7 +21,7 @@ class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase { */ public static $user_ids; - public static function wpSetUpBeforeClass( $factory ) { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { self::$user_ids = array( 'administrator' => self::make_user_by_role( 'administrator' ), 'contributor' => self::make_user_by_role( 'contributor' ),