mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Build/Test Tools: Remove unused posts from AJAX test setUp().
Removes the creation of five posts from the AJAX test suite `setUp()` function, replacing it with a shared fixture only where required. See #51802. git-svn-id: https://develop.svn.wordpress.org/trunk@49696 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a86bedfc92
commit
95751aeec2
@ -149,9 +149,6 @@ abstract class WP_Ajax_UnitTestCase extends WP_UnitTestCase {
|
||||
// Suppress warnings from "Cannot modify header information - headers already sent by".
|
||||
$this->_error_level = error_reporting();
|
||||
error_reporting( $this->_error_level & ~E_WARNING );
|
||||
|
||||
// Make some posts.
|
||||
self::factory()->post->create_many( 5 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -16,6 +16,36 @@ class Tests_Ajax_CustomizeMenus extends WP_Ajax_UnitTestCase {
|
||||
*/
|
||||
public $wp_customize;
|
||||
|
||||
/**
|
||||
* Page IDs.
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
public static $pages;
|
||||
|
||||
/**
|
||||
* Post IDs.
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
public static $posts;
|
||||
|
||||
/**
|
||||
* Term IDs.
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
public static $terms;
|
||||
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
// Make some post objects.
|
||||
self::$posts = $factory->post->create_many( 5 );
|
||||
self::$pages = $factory->post->create_many( 5, array( 'post_type' => 'page' ) );
|
||||
|
||||
// Some terms too.
|
||||
self::$terms = $factory->term->create_many( 5 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the test fixture.
|
||||
*/
|
||||
@ -341,9 +371,6 @@ class Tests_Ajax_CustomizeMenus extends WP_Ajax_UnitTestCase {
|
||||
'url',
|
||||
);
|
||||
|
||||
// Create some terms and pages.
|
||||
self::factory()->term->create_many( 5 );
|
||||
self::factory()->post->create_many( 5, array( 'post_type' => 'page' ) );
|
||||
$auto_draft_post = $this->wp_customize->nav_menus->insert_auto_draft_post(
|
||||
array(
|
||||
'post_title' => 'Test Auto Draft',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user