WordPress.org

Make WordPress Core

Changeset 850 in tests


Ignore:
Timestamp:
07/02/12 06:54:55 (22 months ago)
Author:
nacin
Message:

Port test_query.php. see #96.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-testcase/test_query.php

    r831 r850  
    66// then we test the effects of each url on the wp_query object. 
    77 
    8 class TestWPQueryVars extends _WPDataset1 { 
     8class TestWPQueryVars extends WP_UnitTestCase { 
     9 
     10    protected $page_ids; 
     11    protected $post_ids; 
     12 
    913    function setUp() { 
    1014        parent::setUp(); 
     15 
     16        update_option( 'comments_per_page', 5 ); 
     17        update_option( 'posts_per_page', 5 ); 
     18 
    1119        global $wp_rewrite; 
    12         $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/'); 
     20        update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' ); 
    1321        create_initial_taxonomies(); 
    14         $wp_rewrite->flush_rules(); 
     22        $GLOBALS['wp_rewrite']->init(); 
     23        flush_rewrite_rules(); 
     24 
     25        $this->post_ids[] = $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) ); 
     26        $this->factory->comment->create_post_comments( $post_id, 2 ); 
     27 
     28        $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) ); 
     29        $this->page_ids[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) ); 
     30        $post_ids = $this->factory->post->create_many( 15, array( 'post_date' => '2007-09-04', 'post_content' => 'This content includes "test"', 'post_author' => $user_id ) ); 
     31        foreach ( $post_ids as $post_id ) { 
     32            $this->factory->comment->create_post_comments( $post_id, 2 ); 
     33            $this->factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' ); 
     34        } 
     35        $this->post_ids = array_merge( $this->post_ids, $post_ids ); 
     36 
     37        $this->factory->post->create( array( 'import_id' => 8, 'post_type' => 'attachment' ) ); 
     38        $this->post_ids[] = $this->factory->post->create( array( 'post_date' => '2007-09-04', 'post_title' => 'a-post-with-multiple-pages', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) ); 
     39 
     40        $this->post_ids[] = $post_id = $this->factory->post->create(); 
     41        $cat_id = $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) ); 
     42        $this->factory->term->add_post_terms( $post_id, $cat_id, 'category' ); 
     43 
     44        $this->page_ids[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'lorem-ipsum' ) ); 
     45        $this->page_ids[] = $post_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 
     46        $this->page_ids[] = $post_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $post_id ) ); 
     47        $this->page_ids[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $post_id ) ); 
    1548    } 
    1649 
    1750    function tearDown() { 
    18         global $wp_rewrite; 
    19         $wp_rewrite->set_permalink_structure(''); 
    2051        parent::tearDown(); 
    21     } 
    22  
    23     function _get_post_id_by_name($name) { 
     52        $GLOBALS['wp_rewrite']->init(); 
     53    } 
     54 
     55    function _all_post_ids( $type='post' ) { 
    2456        global $wpdb; 
    25         $name = $wpdb->escape($name); 
    26         $page_id = $wpdb->get_var("SELECT ID from {$wpdb->posts} WHERE post_name = '{$name}' LIMIT 1"); 
    27         assert(is_numeric($page_id)); 
    28         return $page_id; 
    29     } 
    30  
    31     function _all_post_ids($type='post') { 
    32         global $wpdb; 
    33         $type = $wpdb->escape($type); 
    34         return $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type='{$type}' and post_status='publish'"); 
     57        return $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s and post_status='publish'", $type ) ); 
    3558    } 
    3659 
     
    80103 
    81104    function test_home() { 
    82         $this->http('/'); 
     105        $this->go_to('/'); 
    83106        $this->assertQueryTrue('is_home'); 
    84107    } 
    85108 
    86109    function test_404() { 
    87         $this->http('/'.rand_str()); 
     110        $this->go_to('/'.rand_str()); 
    88111        $this->assertQueryTrue('is_404'); 
    89112    } 
    90113 
    91114    function test_permalink() { 
    92         $this->http( get_permalink($this->_get_post_id_by_name('hello-world')) ); 
     115        $this->go_to( get_permalink( get_page_by_path( 'hello-world', OBJECT, 'post' ) ) ); 
    93116        $this->assertQueryTrue('is_single', 'is_singular'); 
    94117    } 
    95118 
    96119    function test_post_comments_feed() { 
    97         $this->http(get_post_comments_feed_link($this->_get_post_id_by_name('hello-world'))); 
     120        $this->go_to( get_post_comments_feed_link( get_page_by_path( 'hello-world', OBJECT, 'post' )->ID ) ); 
    98121        $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed'); 
    99122    } 
    100123 
    101124    function test_page() { 
    102         $page_id = $this->_get_post_id_by_name('about'); 
    103         $this->http(get_permalink($page_id)); 
     125        $page_id = get_page_by_path( 'about' ); 
     126        $this->go_to(get_permalink($page_id)); 
    104127        $this->assertQueryTrue('is_page','is_singular'); 
    105128    } 
    106129 
    107130    function test_parent_page() { 
    108         $page_id = $this->_get_post_id_by_name('parent-page'); 
    109         $this->http(get_permalink($page_id)); 
     131        $page_id = get_page_by_path( 'parent-page' ); 
     132        $this->go_to(get_permalink($page_id)); 
    110133 
    111134        $this->assertQueryTrue('is_page','is_singular'); 
     
    113136 
    114137    function test_child_page_1() { 
    115         $page_id = $this->_get_post_id_by_name('child-page-1'); 
    116         $this->http(get_permalink($page_id)); 
     138        $page_id = get_page_by_path( 'parent-page/child-page-1' ); 
     139        $this->go_to(get_permalink($page_id)); 
    117140 
    118141        $this->assertQueryTrue('is_page','is_singular'); 
     
    120143 
    121144    function test_child_page_2() { 
    122         $page_id = $this->_get_post_id_by_name('child-page-2'); 
    123         $this->http(get_permalink($page_id)); 
     145        $page_id = get_page_by_path( 'parent-page/child-page-1/child-page-2' ); 
     146        $this->go_to(get_permalink($page_id)); 
    124147 
    125148        $this->assertQueryTrue('is_page','is_singular'); 
     
    128151    // '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1' 
    129152    function test_page_trackback() { 
    130         $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2'); 
    131         foreach ($pages as $name) { 
    132             $page_id = $this->_get_post_id_by_name($name); 
     153        foreach ($this->page_ids as $page_id) { 
    133154            $url = get_permalink($page_id); 
    134             $this->http("{$url}trackback/"); 
     155            $this->go_to("{$url}trackback/"); 
    135156 
    136157            // make sure the correct wp_query flags are set 
     
    145166    //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]' 
    146167    function test_page_feed() { 
    147         $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2'); 
    148         foreach ($pages as $name) { 
    149             $page_id = $this->_get_post_id_by_name($name); 
     168        foreach ($this->page_ids as $page_id) { 
    150169            $url = get_permalink($page_id); 
    151             $this->http("{$url}feed/"); 
     170            $this->go_to("{$url}feed/"); 
    152171 
    153172            // make sure the correct wp_query flags are set 
     
    163182    // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]' 
    164183    function test_page_feed_atom() { 
    165         $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2'); 
    166         foreach ($pages as $name) { 
    167             $page_id = $this->_get_post_id_by_name($name); 
     184        foreach ($this->page_ids as $page_id) { 
    168185            $url = get_permalink($page_id); 
    169             $this->http("{$url}feed/atom/"); 
     186            $this->go_to("{$url}feed/atom/"); 
    170187 
    171188            // make sure the correct wp_query flags are set 
     
    180197    // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]' 
    181198    function test_page_page_2() { 
    182         $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2'); 
    183         foreach ($pages as $name) { 
    184             $page_id = $this->_get_post_id_by_name($name); 
     199        foreach ($this->page_ids as $page_id) { 
    185200            $url = get_permalink($page_id); 
    186             $this->http("{$url}page/2/"); 
     201            $this->go_to("{$url}page/2/"); 
    187202 
    188203            // make sure the correct wp_query flags are set 
     
    200215        //return $this->markTestSkipped(); 
    201216        // identical to /about/page/2/ ? 
    202         $this->http('/about/2/'); 
     217        $this->go_to('/about/2/'); 
    203218 
    204219        $this->assertQueryTrue('is_page', 'is_singular'); 
     
    218233        // long version 
    219234        foreach ($feeds as $feed) { 
    220             $this->http("/feed/{$feed}/"); 
     235            $this->go_to("/feed/{$feed}/"); 
    221236            $this->assertQueryTrue('is_feed'); 
    222237        } 
     
    224239        // short version 
    225240        foreach ($feeds as $feed) { 
    226             $this->http("/{$feed}/"); 
     241            $this->go_to("/{$feed}/"); 
    227242            $this->assertQueryTrue('is_feed'); 
    228243        } 
     
    233248        $types = array('rss2', 'rss', 'atom'); 
    234249        foreach ($types as $type) { 
    235             $this->http(get_feed_link($type)); 
     250            $this->go_to(get_feed_link($type)); 
    236251            $this->assertQueryTrue('is_feed'); 
    237252        } 
     
    241256    function test_paged() { 
    242257        for ($i=2; $i<4; $i++) { 
    243             $this->http("/page/{$i}/"); 
     258            $this->go_to("/page/{$i}/"); 
    244259            $this->assertQueryTrue('is_home', 'is_paged'); 
    245260        } 
     
    250265    function test_main_comments_feed() { 
    251266        // check the url as generated by get_post_comments_feed_link() 
    252         $this->http(get_post_comments_feed_link($this->_get_post_id_by_name('hello-world'))); 
     267        $this->go_to( get_post_comments_feed_link( get_page_by_path( 'hello-world', OBJECT, 'post' )->ID ) ); 
    253268        $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed'); 
    254269 
     
    256271        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    257272        foreach ($types as $type) { 
    258                 $this->http("/comments/feed/{$type}"); 
     273                $this->go_to("/comments/feed/{$type}"); 
    259274                $this->assertQueryTrue('is_feed', 'is_comment_feed'); 
    260275        } 
     
    263278        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    264279        foreach ($types as $type) { 
    265                 $this->http("/comments/{$type}"); 
     280                $this->go_to("/comments/{$type}"); 
    266281                $this->assertQueryTrue('is_feed', 'is_comment_feed'); 
    267282        } 
     
    271286    // 'comments/page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]', 
    272287    function test_comments_page() { 
    273         $this->http('/comments/page/2/'); 
     288        $this->go_to('/comments/page/2/'); 
    274289        $this->assertQueryTrue('is_home', 'is_paged'); 
    275290    } 
     
    282297        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    283298        foreach ($types as $type) { 
    284                 $this->http("/search/test/feed/{$type}"); 
     299                $this->go_to("/search/test/feed/{$type}"); 
    285300                $this->assertQueryTrue('is_feed', 'is_search'); 
    286301        } 
     
    289304        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    290305        foreach ($types as $type) { 
    291                 $this->http("/search/test/{$type}"); 
     306                $this->go_to("/search/test/{$type}"); 
    292307                $this->assertQueryTrue('is_feed', 'is_search'); 
    293308        } 
     
    296311    // 'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]', 
    297312    function test_search_paged() { 
    298         $this->http('/search/test/page/2/'); 
     313        $this->go_to('/search/test/page/2/'); 
    299314        $this->assertQueryTrue('is_search', 'is_paged'); 
    300315    } 
     
    302317    // 'search/(.+)/?$' => 'index.php?s=$matches[1]', 
    303318    function test_search() { 
    304         $this->http('/search/test/'); 
     319        $this->go_to('/search/test/'); 
    305320        $this->assertQueryTrue('is_search'); 
    306321    } 
     
    308323    function test_search_encoded_chars() { 
    309324        $this->knownWPBug(13961); 
    310         $this->http('/search/F%C3%BCnf%2Bbar/'); 
     325        $this->go_to('/search/F%C3%BCnf%2Bbar/'); 
    311326        $this->assertEquals( get_query_var( 's' ), 'Fünf+bar' ); 
    312327    } 
     
    318333        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    319334        foreach ($types as $type) { 
    320                 $this->http("/category/cat-a/feed/{$type}"); 
     335                $this->go_to("/category/cat-a/feed/{$type}"); 
    321336                $this->assertQueryTrue('is_archive', 'is_feed', 'is_category'); 
    322337        } 
     
    325340        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    326341        foreach ($types as $type) { 
    327                 $this->http("/category/cat-a/{$type}"); 
     342                $this->go_to("/category/cat-a/{$type}"); 
    328343                $this->assertQueryTrue('is_archive', 'is_feed', 'is_category'); 
    329344        } 
     
    332347    // 'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]', 
    333348    function test_category_paged() { 
    334         $this->http('/category/uncategorized/page/2/'); 
     349        $this->go_to('/category/uncategorized/page/2/'); 
    335350        $this->assertQueryTrue('is_archive', 'is_category', 'is_paged'); 
    336351    } 
     
    338353    // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]', 
    339354    function test_category() { 
    340         $this->http('/category/cat-a/'); 
     355        $this->go_to('/category/cat-a/'); 
    341356        $this->assertQueryTrue('is_archive', 'is_category'); 
    342357    } 
     
    348363        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    349364        foreach ($types as $type) { 
    350                 $this->http("/tag/tag-a/feed/{$type}"); 
     365                $this->go_to("/tag/tag-a/feed/{$type}"); 
    351366                $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag'); 
    352367        } 
     
    355370        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    356371        foreach ($types as $type) { 
    357                 $this->http("/tag/tag-a/{$type}"); 
     372                $this->go_to("/tag/tag-a/{$type}"); 
    358373                $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag'); 
    359374        } 
     
    363378    function test_tag_paged() { 
    364379        $this->markTestSkipped(); // tag-a doesn't have enough posts -> 404 
    365         $this->http('/tag/tag-a/page/2/'); 
     380        $this->go_to('/tag/tag-a/page/2/'); 
    366381        $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged'); 
    367382    } 
     
    369384    // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]', 
    370385    function test_tag() { 
    371         $this->http('/tag/tag-a/'); 
     386        $this->go_to('/tag/tag-a/'); 
    372387        $this->assertQueryTrue('is_archive', 'is_tag'); 
    373388    } 
     
    379394        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    380395        foreach ($types as $type) { 
    381                 $this->http("/author/user-a/feed/{$type}"); 
     396                $this->go_to("/author/user-a/feed/{$type}"); 
    382397                $this->assertQueryTrue('is_archive', 'is_feed', 'is_author'); 
    383398        } 
     
    386401        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    387402        foreach ($types as $type) { 
    388                 $this->http("/author/user-a/{$type}"); 
     403                $this->go_to("/author/user-a/{$type}"); 
    389404                $this->assertQueryTrue('is_archive', 'is_feed', 'is_author'); 
    390405        } 
     
    393408    // 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]', 
    394409    function test_author_paged() { 
    395         $this->http('/author/user-a/page/2/'); 
     410        $this->go_to('/author/user-a/page/2/'); 
    396411        $this->assertQueryTrue('is_archive', 'is_author', 'is_paged'); 
    397412    } 
     
    399414    // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]', 
    400415    function test_author() { 
    401         $this->http('/author/user-a/'); 
     416        $this->go_to('/author/user-a/'); 
    402417        $this->assertQueryTrue('is_archive', 'is_author'); 
    403418    } 
     
    409424        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    410425        foreach ($types as $type) { 
    411                 $this->http("/2007/09/04/feed/{$type}"); 
     426                $this->go_to("/2007/09/04/feed/{$type}"); 
    412427                $this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date'); 
    413428        } 
     
    416431        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    417432        foreach ($types as $type) { 
    418                 $this->http("/2007/09/04/{$type}"); 
     433                $this->go_to("/2007/09/04/{$type}"); 
    419434                $this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date'); 
    420435        } 
     
    423438    // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]', 
    424439    function test_ymd_paged() { 
    425         $this->http('/2007/09/04/page/2/'); 
     440        $this->go_to('/2007/09/04/page/2/'); 
    426441        $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged'); 
    427442    } 
     
    429444    // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]', 
    430445    function test_ymd() { 
    431         $this->http('/2007/09/04/'); 
     446        $this->go_to('/2007/09/04/'); 
    432447        $this->assertQueryTrue('is_archive', 'is_day', 'is_date'); 
    433448    } 
     
    439454        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    440455        foreach ($types as $type) { 
    441                 $this->http("/2007/09/feed/{$type}"); 
     456                $this->go_to("/2007/09/feed/{$type}"); 
    442457                $this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date'); 
    443458        } 
     
    446461        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    447462        foreach ($types as $type) { 
    448                 $this->http("/2007/09/{$type}"); 
     463                $this->go_to("/2007/09/{$type}"); 
    449464                $this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date'); 
    450465        } 
     
    453468    // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]', 
    454469    function test_ym_paged() { 
    455         $this->http('/2007/09/page/2/'); 
     470        $this->go_to('/2007/09/page/2/'); 
    456471        $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged'); 
    457472    } 
     
    459474    // '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]', 
    460475    function test_ym() { 
    461         $this->http('/2007/09/'); 
     476        $this->go_to('/2007/09/'); 
    462477        $this->assertQueryTrue('is_archive', 'is_date', 'is_month'); 
    463478    } 
     
    469484        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    470485        foreach ($types as $type) { 
    471                 $this->http("/2007/feed/{$type}"); 
     486                $this->go_to("/2007/feed/{$type}"); 
    472487                $this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date'); 
    473488        } 
     
    476491        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    477492        foreach ($types as $type) { 
    478                 $this->http("/2007/{$type}"); 
     493                $this->go_to("/2007/{$type}"); 
    479494                $this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date'); 
    480495        } 
     
    483498    // '([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]', 
    484499    function test_y_paged() { 
    485         $this->http('/2007/page/2/'); 
     500        $this->go_to('/2007/page/2/'); 
    486501        $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged'); 
    487502    } 
     
    489504    // '([0-9]{4})/?$' => 'index.php?year=$matches[1]', 
    490505    function test_y() { 
    491         $this->http('/2007/'); 
     506        $this->go_to('/2007/'); 
    492507        $this->assertQueryTrue('is_archive', 'is_date', 'is_year'); 
    493508    } 
     
    496511    // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1', 
    497512    function test_post_trackback() { 
    498         foreach ($this->_all_post_ids() as $id) { 
    499             $permalink = get_permalink($id); 
    500             $this->http("{$permalink}trackback/"); 
     513        foreach ( $this->post_ids as $post_id ) { 
     514            $permalink = get_permalink( $post_id ); 
     515            $this->go_to("{$permalink}trackback/"); 
    501516            $this->assertQueryTrue('is_single', 'is_singular', 'is_trackback'); 
    502517        } 
     
    506521    // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]', 
    507522    function test_post_comment_feed() { 
    508         foreach ($this->_all_post_ids() as $id) { 
    509             $permalink = get_permalink($id); 
     523        foreach ( $this->post_ids as $post_id ) { 
     524            $permalink = get_permalink( $post_id ); 
    510525 
    511526            $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    512527            foreach ($types as $type) { 
    513                     $this->http("{$permalink}feed/{$type}"); 
     528                    $this->go_to("{$permalink}feed/{$type}"); 
    514529                    $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed'); 
    515530            } 
     
    518533            $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 
    519534            foreach ($types as $type) { 
    520                     $this->http("{$permalink}{$type}"); 
     535                    $this->go_to("{$permalink}{$type}"); 
    521536                    $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed'); 
    522537            } 
     
    529544        $this->markTestSkipped(); // @todo post doesn't exist in Data Set 1, plus /page/x isn't for single posts 
    530545        // the long version 
    531         $this->http('/2007/09/04/a-post-with-multiple-pages/page/2/'); 
     546        $this->go_to('/2007/09/04/a-post-with-multiple-pages/page/2/'); 
    532547        // should is_paged be true also? 
    533548        $this->assertQueryTrue('is_single', 'is_singular'); 
     
    538553        $this->markTestSkipped(); // @todo post doesn't exist in Data Set 1 
    539554        // and the short version 
    540         $this->http('/2007/09/04/a-post-with-multiple-pages/2/'); 
     555        $this->go_to('/2007/09/04/a-post-with-multiple-pages/2/'); 
    541556        // should is_paged be true also? 
    542557        $this->assertQueryTrue('is_single', 'is_singular'); 
     
    548563        $this->markTestSkipped(); // @todo ID 8 is a page in Data Set 1 
    549564        $permalink = get_attachment_link(8); 
    550         $this->http($permalink); 
     565        $this->go_to($permalink); 
    551566        $this->assertQueryTrue('is_attachment', 'is_singular'); 
    552567    } 
     
    565580        parent::setUp(); 
    566581        global $wp_rewrite; 
    567         $wp_rewrite->set_permalink_structure('/%author%/%year%/%postname%/'); 
     582        update_option( 'permalink_structure', '/%author%/%year%/%postname%/' ); 
    568583        create_initial_taxonomies(); 
    569         $wp_rewrite->flush_rules(); 
     584        $GLOBALS['wp_rewrite']->init(); 
     585        flush_rewrite_rules(); 
    570586    } 
    571587} 
Note: See TracChangeset for help on using the changeset viewer.