Use shared fixtures in RSS2 unit tests.
See #31705, #30017. git-svn-id: https://develop.svn.wordpress.org/trunk@31848 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e3b2637699
commit
6d7c4f39f0
@ -11,6 +11,34 @@
|
|||||||
class Tests_Feed_RSS2 extends WP_UnitTestCase {
|
class Tests_Feed_RSS2 extends WP_UnitTestCase {
|
||||||
private $permalink_structure = '';
|
private $permalink_structure = '';
|
||||||
|
|
||||||
|
static $user;
|
||||||
|
static $posts;
|
||||||
|
|
||||||
|
public static function setUpBeforeClass() {
|
||||||
|
$factory = new WP_UnitTest_Factory();
|
||||||
|
|
||||||
|
self::$user = $factory->user->create();
|
||||||
|
self::$posts = $factory->post->create_many( 25, array(
|
||||||
|
'post_author' => self::$user,
|
||||||
|
) );
|
||||||
|
|
||||||
|
self::commit_transaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function tearDownAfterClass() {
|
||||||
|
if ( is_multisite() ) {
|
||||||
|
wpmu_delete_user( self::$user );
|
||||||
|
} else {
|
||||||
|
wp_delete_user( self::$user );
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( self::$posts as $post ) {
|
||||||
|
wp_delete_post( $post, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
self::commit_transaction();
|
||||||
|
}
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
global $wp_rewrite;
|
global $wp_rewrite;
|
||||||
$this->permalink_structure = get_option( 'permalink_structure' );
|
$this->permalink_structure = get_option( 'permalink_structure' );
|
||||||
@ -19,11 +47,6 @@ class Tests_Feed_RSS2 extends WP_UnitTestCase {
|
|||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$u = $this->factory->user->create();
|
|
||||||
$this->factory->post->create_many( 25, array(
|
|
||||||
'post_author' => $u,
|
|
||||||
) );
|
|
||||||
|
|
||||||
$this->post_count = get_option('posts_per_rss');
|
$this->post_count = get_option('posts_per_rss');
|
||||||
$this->excerpt_only = get_option('rss_use_excerpt');
|
$this->excerpt_only = get_option('rss_use_excerpt');
|
||||||
// this seems to break something
|
// this seems to break something
|
||||||
|
Loading…
Reference in New Issue
Block a user