Make WordPress Core


Ignore:
Timestamp:
07/03/2014 01:42:57 AM (12 years ago)
Author:
wonderboymusic
Message:

Setup rewrite changes in tests in a predictable fashion. Don't mix method calls with wrapper function calls.

See #28706.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/query/taxQuery.php

    r26875 r28966  
    2323
    2424        function setUp() {
     25                global $wp_rewrite;
    2526                parent::setUp();
    2627
    2728                set_current_screen( 'front' );
    2829
    29                 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
    30 
    3130                $GLOBALS['wp_the_query'] = new WP_Query();
    3231                $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
     32
     33                $wp_rewrite->init();
     34                $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    3335
    3436                create_initial_taxonomies();
    3537                register_taxonomy( 'testtax', 'post', array( 'public' => true ) );
    3638
    37                 $GLOBALS['wp_rewrite']->init();
    38                 flush_rewrite_rules();
     39                $wp_rewrite->flush_rules();
    3940
    4041                $this->tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) );
    … …  
    5758
    5859        function tearDown() {
     60                global $wp_rewrite;
    5961                parent::tearDown();
    6062
    6163                _unregister_taxonomy( 'testtax' );
     64
     65                $wp_rewrite->init();
    6266
    6367                remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
Note: See TracChangeset for help on using the changeset viewer.