Make WordPress Core

Changeset 31848


Ignore:
Timestamp:
03/20/2015 12:34:28 PM (9 years ago)
Author:
boonebgorges
Message:

Use shared fixtures in RSS2 unit tests.

See #31705, #30017.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/feed/rss2.php

    r31846 r31848  
    1212    private $permalink_structure = '';
    1313
     14    static $user;
     15    static $posts;
     16
     17    public static function setUpBeforeClass() {
     18        $factory = new WP_UnitTest_Factory();
     19
     20        self::$user = $factory->user->create();
     21        self::$posts = $factory->post->create_many( 25, array(
     22            'post_author' => self::$user,
     23        ) );
     24
     25        self::commit_transaction();
     26    }
     27
     28    public static function tearDownAfterClass() {
     29        if ( is_multisite() ) {
     30            wpmu_delete_user( self::$user );
     31        } else {
     32            wp_delete_user( self::$user );
     33        }
     34
     35        foreach ( self::$posts as $post ) {
     36            wp_delete_post( $post, true );
     37        }
     38
     39        self::commit_transaction();
     40    }
     41
    1442    public function setUp() {
    1543        global $wp_rewrite;
     
    1947
    2048        parent::setUp();
    21 
    22         $u = $this->factory->user->create();
    23         $this->factory->post->create_many( 25, array(
    24             'post_author' => $u,
    25         ) );
    2649
    2750        $this->post_count = get_option('posts_per_rss');
Note: See TracChangeset for help on using the changeset viewer.