Make WordPress Core

Changeset 35191


Ignore:
Timestamp:
10/15/2015 05:50:40 AM (9 years ago)
Author:
wonderboymusic
Message:

Unit Tests: after [35186], "upgrade" the Canonical fixtures.

See #30017, #33968.

Location:
trunk/tests/phpunit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase-canonical.php

    r34802 r35191  
    3939     * @since 4.1.0
    4040     */
    41     public static function generate_shared_fixtures() {
    42         global $wp_rewrite;
    43 
    44         $factory = new WP_UnitTest_Factory;
    45 
     41    public static function generate_shared_fixtures( $factory ) {
    4642        self::$old_current_user = get_current_user_id();
    4743        self::$author_id = $factory->user->create( array( 'user_login' => 'canonical-author' ) );
     
    131127        $tag1 = $factory->term->create( array( 'name' => 'post-formats' ) );
    132128        self::$term_ids[ $tag1 ] = 'post_tag';
    133 
    134         self::commit_transaction();
    135129    }
    136130
     
    141135     */
    142136    public static function delete_shared_fixtures() {
    143         global $wp_rewrite;
    144 
    145137        if ( is_multisite() ) {
    146138            wpmu_delete_user( self::$author_id );
     
    166158        self::$term_ids = array();
    167159        self::$terms = array();
    168 
    169         self::commit_transaction();
    170160    }
    171161
  • trunk/tests/phpunit/tests/canonical.php

    r35177 r35191  
    1010 */
    1111class Tests_Canonical extends WP_Canonical_UnitTestCase {
    12     public static function setUpBeforeClass() {
    13         self::generate_shared_fixtures();
     12    public static function wpSetUpBeforeClass( $factory ) {
     13        self::generate_shared_fixtures( $factory );
    1414    }
    1515
    16     public static function tearDownAfterClass() {
     16    public static function wpTearDownAfterClass() {
    1717        self::delete_shared_fixtures();
    1818    }
  • trunk/tests/phpunit/tests/canonical/noRewrite.php

    r30277 r35191  
    1111
    1212    // These test cases are run against the test handler in WP_Canonical
    13     public static function setUpBeforeClass() {
    14         self::generate_shared_fixtures();
     13    public static function wpSetUpBeforeClass( $factory ) {
     14        self::generate_shared_fixtures( $factory );
    1515    }
    1616
    17     public static function tearDownAfterClass() {
     17    public static function wpTearDownAfterClass() {
    1818        self::delete_shared_fixtures();
    1919    }
     
    2727        $wp_rewrite->set_permalink_structure( '' );
    2828        $wp_rewrite->flush_rules();
    29         $wp_rewrite->init();
    3029    }
    3130
  • trunk/tests/phpunit/tests/canonical/pageOnFront.php

    r31622 r35191  
    77 */
    88class Tests_Canonical_PageOnFront extends WP_Canonical_UnitTestCase {
    9     public static function setUpBeforeClass() {
    10         self::generate_shared_fixtures();
     9    public static function wpSetUpBeforeClass( $factory ) {
     10        self::generate_shared_fixtures( $factory );
    1111    }
    1212
    13     public static function tearDownAfterClass() {
     13    public static function wpTearDownAfterClass() {
    1414        self::delete_shared_fixtures();
    1515    }
     
    1717    function setUp() {
    1818        parent::setUp();
    19         global $wp_rewrite;
     19
    2020        update_option( 'show_on_front', 'page' );
    2121        update_option( 'page_for_posts', $this->factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) );
    2222        update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
    23         $wp_rewrite->init();
    24         $wp_rewrite->flush_rules();
    25     }
    26 
    27     function tearDown() {
    28         global $wp_rewrite;
    29         $wp_rewrite->init();
    30         parent::tearDown();
    3123    }
    3224
Note: See TracChangeset for help on using the changeset viewer.