Make WordPress Core

Changeset 863 in tests


Ignore:
Timestamp:
07/02/2012 05:58:37 PM (14 years ago)
Author:
nacin
Message:

Move all factory work for test_query.php into individual tests. No skipped tests, no incomplete tests. see #96. see #WP21138.

File:
1 edited

Legend:

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

    r855 r863  
    2222        $GLOBALS['wp_rewrite']->init();
    2323        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 00:00:00', '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 00:00:00', '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 ) );
    4824    }
    4925
     
    11389
    11490    function test_permalink() {
    115         $this->go_to( get_permalink( get_page_by_path( 'hello-world', OBJECT, 'post' ) ) );
     91        $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
     92        $this->go_to( get_permalink( $post_id ) );
    11693        $this->assertQueryTrue('is_single', 'is_singular');
    11794    }
    11895
    11996    function test_post_comments_feed() {
    120         $this->go_to( get_post_comments_feed_link( get_page_by_path( 'hello-world', OBJECT, 'post' )->ID ) );
     97        $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
     98        // Comments aren't needed for this test to pass.
     99        // $this->factory->comment->create_post_comments( $post_id, 2 );
     100        $this->go_to( get_post_comments_feed_link( $post_id ) );
    121101        $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
    122102    }
    123103
    124104    function test_page() {
    125         $page_id = get_page_by_path( 'about' );
    126         $this->go_to(get_permalink($page_id));
     105        $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
     106        $this->go_to( get_permalink( $page_id ) );
    127107        $this->assertQueryTrue('is_page','is_singular');
    128108    }
    129109
    130110    function test_parent_page() {
    131         $page_id = get_page_by_path( 'parent-page' );
    132         $this->go_to(get_permalink($page_id));
     111        $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     112        $this->go_to( get_permalink( $page_id ) );
    133113
    134114        $this->assertQueryTrue('is_page','is_singular');
     
    136116
    137117    function test_child_page_1() {
    138         $page_id = get_page_by_path( 'parent-page/child-page-1' );
    139         $this->go_to(get_permalink($page_id));
     118        $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     119        $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     120        $this->go_to( get_permalink( $page_id ) );
    140121
    141122        $this->assertQueryTrue('is_page','is_singular');
     
    143124
    144125    function test_child_page_2() {
    145         $page_id = get_page_by_path( 'parent-page/child-page-1/child-page-2' );
    146         $this->go_to(get_permalink($page_id));
     126        $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     127        $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     128        $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     129        $this->go_to( get_permalink( $page_id ) );
    147130
    148131        $this->assertQueryTrue('is_page','is_singular');
     
    151134    // '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1'
    152135    function test_page_trackback() {
    153         foreach ($this->page_ids as $page_id) {
    154             $url = get_permalink($page_id);
     136        $page_ids = array();
     137        $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     138        $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     139        $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     140        foreach ( $page_ids as $page_id ) {
     141            $url = get_permalink( $page_id );
    155142            $this->go_to("{$url}trackback/");
    156143
     
    166153    //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
    167154    function test_page_feed() {
    168         foreach ($this->page_ids as $page_id) {
    169             $url = get_permalink($page_id);
     155        $page_ids = array();
     156        $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     157        $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     158        $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     159        foreach ( $page_ids as $page_id ) {
     160            // Comments aren't needed for this test to pass.
     161            // $this->factory->comment->create_post_comments( $page_id, 2 );
     162
     163            $url = get_permalink( $page_id );
    170164            $this->go_to("{$url}feed/");
    171165
     
    182176    // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
    183177    function test_page_feed_atom() {
    184         foreach ($this->page_ids as $page_id) {
    185             $url = get_permalink($page_id);
     178        $page_ids = array();
     179        $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     180        $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     181        $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     182        foreach ( $page_ids as $page_id ) {
     183            // Comments aren't needed for this test to pass.
     184            // $this->factory->comment->create_post_comments( $page_id, 2 );
     185
     186            $url = get_permalink( $page_id );
    186187            $this->go_to("{$url}feed/atom/");
    187188
     
    197198    // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
    198199    function test_page_page_2() {
    199         foreach ($this->page_ids as $page_id) {
    200             $url = get_permalink($page_id);
    201             $this->go_to("{$url}page/2/");
    202 
    203             // make sure the correct wp_query flags are set
    204             $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
    205 
    206             // make sure the correct page was fetched
    207             global $wp_query;
    208             $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
    209         }
    210     }
    211 
     200        $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
     201        $this->go_to("/about/page/2/");
     202
     203        // make sure the correct wp_query flags are set
     204        $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
     205
     206        // make sure the correct page was fetched
     207        global $wp_query;
     208        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
     209    }
     210
     211    // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
     212    function test_page_page_2_no_slash() {
     213        $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
     214        $this->go_to("/about/page2/");
     215
     216        // make sure the correct wp_query flags are set
     217        $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
     218
     219        // make sure the correct page was fetched
     220        global $wp_query;
     221        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
     222    }
     223   
    212224    // FIXME: what is this for?
    213225    // '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]'
    214     function test_page_page_2_short() {
    215         //return $this->markTestSkipped();
    216         // identical to /about/page/2/ ?
     226    function test_pagination_of_posts_page() {
     227        $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
     228        update_option( 'show_on_front', 'page' );
     229        update_option( 'page_for_posts', $page_id );
     230
    217231        $this->go_to('/about/2/');
    218232
    219         $this->assertQueryTrue('is_page', 'is_singular');
     233        $this->assertQueryTrue( 'is_home', 'is_posts_page' );
     234
     235        // make sure the correct page was fetched
     236        global $wp_query;
     237        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
    220238    }
    221239
     
    229247    // '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
    230248    function test_main_feed_2() {
     249        $this->factory->post->create(); // @test_404
    231250        $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    232251
     
    246265
    247266    function test_main_feed() {
     267        $this->factory->post->create(); // @test_404
    248268        $types = array('rss2', 'rss', 'atom');
    249269        foreach ($types as $type) {
     
    255275    // 'page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
    256276    function test_paged() {
    257         for ($i=2; $i<4; $i++) {
     277        $this->factory->post->create_many( 15 );
     278        for ( $i = 2; $i <= 3; $i++ ) {
    258279            $this->go_to("/page/{$i}/");
    259280            $this->assertQueryTrue('is_home', 'is_paged');
     
    264285    // 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
    265286    function test_main_comments_feed() {
     287        $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
     288        $this->factory->comment->create_post_comments( $post_id, 2 );
     289
    266290        // check the url as generated by get_post_comments_feed_link()
    267         $this->go_to( get_post_comments_feed_link( get_page_by_path( 'hello-world', OBJECT, 'post' )->ID ) );
     291        $this->go_to( get_post_comments_feed_link( $post_id ) );
    268292        $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
    269293
     
    283307
    284308    }
    285 
    286     // 'comments/page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
    287     function test_comments_page() {
    288         $this->go_to('/comments/page/2/');
    289         $this->assertQueryTrue('is_home', 'is_paged');
    290     }
    291 
    292309
    293310    // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
     
    311328    // 'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]',
    312329    function test_search_paged() {
     330        $this->factory->post->create_many( 10, array( 'post_title' => 'test' ) );
    313331        $this->go_to('/search/test/page/2/');
    314332        $this->assertQueryTrue('is_search', 'is_paged');
     
    322340
    323341    function test_search_encoded_chars() {
    324         $this->knownWPBug(13961);
     342        // $this->knownWPBug(13961);
    325343        $this->go_to('/search/F%C3%BCnf%2Bbar/');
    326344        $this->assertEquals( get_query_var( 's' ), 'Fünf+bar' );
     
    330348    // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
    331349    function test_category_feed() {
     350        $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
    332351        // check the long form
    333352        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    347366    // 'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
    348367    function test_category_paged() {
     368        $this->factory->post->create_many( 10 );
    349369        $this->go_to('/category/uncategorized/page/2/');
    350370        $this->assertQueryTrue('is_archive', 'is_category', 'is_paged');
     
    353373    // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
    354374    function test_category() {
     375        $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
    355376        $this->go_to('/category/cat-a/');
    356377        $this->assertQueryTrue('is_archive', 'is_category');
     
    360381    // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
    361382    function test_tag_feed() {
     383        $this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
    362384        // check the long form
    363385        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    377399    // 'tag/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]',
    378400    function test_tag_paged() {
    379         $this->markTestSkipped(); // tag-a doesn't have enough posts -> 404
     401        $post_ids = $this->factory->post->create_many( 10 );
     402        foreach ( $post_ids as $post_id )
     403            $this->factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );
     404        // $this->markTestSkipped(); // tag-a doesn't have enough posts -> 404
    380405        $this->go_to('/tag/tag-a/page/2/');
    381406        $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged');
     
    384409    // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
    385410    function test_tag() {
     411        $this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
    386412        $this->go_to('/tag/tag-a/');
    387413        $this->assertQueryTrue('is_archive', 'is_tag');
     
    391417    // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
    392418    function test_author_feed() {
     419        $this->factory->user->create( array( 'user_login' => 'user-a' ) );
    393420        // check the long form
    394421        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    408435    // 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
    409436    function test_author_paged() {
     437        $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
     438        $this->factory->post->create_many( 10, array( 'post_author' => $user_id ) );
    410439        $this->go_to('/author/user-a/page/2/');
    411440        $this->assertQueryTrue('is_archive', 'is_author', 'is_paged');
     
    414443    // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
    415444    function test_author() {
     445        $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
     446        // A post isn't needed for this test to pass.
     447        // $this->factory->post->create( array( 'post_author' => $user_id ) );
    416448        $this->go_to('/author/user-a/');
    417449        $this->assertQueryTrue('is_archive', 'is_author');
     
    421453    // '([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]&feed=$matches[4]',
    422454    function test_ymd_feed() {
     455        $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    423456        // check the long form
    424457        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    438471    // '([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]',
    439472    function test_ymd_paged() {
     473        $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
    440474        $this->go_to('/2007/09/04/page/2/');
    441475        $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
     
    444478    // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
    445479    function test_ymd() {
     480        $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    446481        $this->go_to('/2007/09/04/');
    447482        $this->assertQueryTrue('is_archive', 'is_day', 'is_date');
     
    451486    // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
    452487    function test_ym_feed() {
     488        $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    453489        // check the long form
    454490        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    468504    // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]',
    469505    function test_ym_paged() {
     506        $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
    470507        $this->go_to('/2007/09/page/2/');
    471508        $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
     
    474511    // '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]',
    475512    function test_ym() {
     513        $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    476514        $this->go_to('/2007/09/');
    477515        $this->assertQueryTrue('is_archive', 'is_date', 'is_month');
     
    481519    // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
    482520    function test_y_feed() {
     521        $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    483522        // check the long form
    484523        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    498537    // '([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]',
    499538    function test_y_paged() {
     539        $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
    500540        $this->go_to('/2007/page/2/');
    501541        $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
     
    504544    // '([0-9]{4})/?$' => 'index.php?year=$matches[1]',
    505545    function test_y() {
     546        $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    506547        $this->go_to('/2007/');
    507548        $this->assertQueryTrue('is_archive', 'is_date', 'is_year');
    508549    }
    509550
    510 
    511551    // '([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',
    512552    function test_post_trackback() {
    513         foreach ( $this->post_ids as $post_id ) {
    514             $permalink = get_permalink( $post_id );
    515             $this->go_to("{$permalink}trackback/");
    516             $this->assertQueryTrue('is_single', 'is_singular', 'is_trackback');
    517         }
     553        $post_id = $this->factory->post->create();
     554        $permalink = get_permalink( $post_id );
     555        $this->go_to("{$permalink}trackback/");
     556        $this->assertQueryTrue('is_single', 'is_singular', 'is_trackback');
    518557    }
    519558
     
    521560    // '([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]',
    522561    function test_post_comment_feed() {
    523         foreach ( $this->post_ids as $post_id ) {
    524             $permalink = get_permalink( $post_id );
    525 
    526             $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    527             foreach ($types as $type) {
    528                     $this->go_to("{$permalink}feed/{$type}");
    529                     $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
    530             }
    531 
    532             // check the short form
    533             $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    534             foreach ($types as $type) {
    535                     $this->go_to("{$permalink}{$type}");
    536                     $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
    537             }
    538 
    539         }
    540     }
    541 
    542     // '([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]&name=$matches[4]&paged=$matches[5]',
    543     function test_post_paged_long() {
    544         $this->markTestSkipped(); // @todo post doesn't exist in Data Set 1, plus /page/x isn't for single posts
    545         // the long version
    546         $this->go_to('/2007/09/04/a-post-with-multiple-pages/page/2/');
    547         // should is_paged be true also?
    548         $this->assertQueryTrue('is_single', 'is_singular');
     562        $post_id = $this->factory->post->create();
     563        $permalink = get_permalink( $post_id );
     564
     565        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     566        foreach ($types as $type) {
     567                $this->go_to("{$permalink}feed/{$type}");
     568                $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
     569        }
     570
     571        // check the short form
     572        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     573        foreach ($types as $type) {
     574                $this->go_to("{$permalink}{$type}");
     575                $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
     576        }
    549577    }
    550578
    551579    // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]',
    552580    function test_post_paged_short() {
    553         $this->markTestSkipped(); // @todo post doesn't exist in Data Set 1
     581        $this->factory->post->create( array(
     582            'post_date' => '2007-09-04 00:00:00',
     583            'post_title' => 'a-post-with-multiple-pages',
     584            'post_content' => 'Page 1 <!--nextpage--> Page 2'
     585        ) );
     586        // $this->markTestSkipped(); // @todo post doesn't exist in Data Set 1
    554587        // and the short version
    555588        $this->go_to('/2007/09/04/a-post-with-multiple-pages/2/');
     
    561594    // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
    562595    function test_post_attachment() {
    563         $this->markTestSkipped(); // @todo ID 8 is a page in Data Set 1
    564         $permalink = get_attachment_link(8);
     596        $post_id = $this->factory->post->create( array( 'post_type' => 'attachment' ) );
     597        $permalink = get_attachment_link( $post_id );
    565598        $this->go_to($permalink);
    566         $this->assertQueryTrue('is_attachment', 'is_singular');
     599        $this->assertQueryTrue('is_single', 'is_attachment', 'is_singular');
    567600    }
    568601
Note: See TracChangeset for help on using the changeset viewer.