Changeset 863 in tests
- Timestamp:
- 07/02/2012 05:58:37 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/wp-testcase/test_query.php (modified) (35 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-testcase/test_query.php
r855 r863 22 22 $GLOBALS['wp_rewrite']->init(); 23 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 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 ) );48 24 } 49 25 … … 113 89 114 90 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 ) ); 116 93 $this->assertQueryTrue('is_single', 'is_singular'); 117 94 } 118 95 119 96 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 ) ); 121 101 $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed'); 122 102 } 123 103 124 104 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 ) ); 127 107 $this->assertQueryTrue('is_page','is_singular'); 128 108 } 129 109 130 110 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 ) ); 133 113 134 114 $this->assertQueryTrue('is_page','is_singular'); … … 136 116 137 117 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 ) ); 140 121 141 122 $this->assertQueryTrue('is_page','is_singular'); … … 143 124 144 125 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 ) ); 147 130 148 131 $this->assertQueryTrue('is_page','is_singular'); … … 151 134 // '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1' 152 135 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 ); 155 142 $this->go_to("{$url}trackback/"); 156 143 … … 166 153 //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]' 167 154 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 ); 170 164 $this->go_to("{$url}feed/"); 171 165 … … 182 176 // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]' 183 177 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 ); 186 187 $this->go_to("{$url}feed/atom/"); 187 188 … … 197 198 // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]' 198 199 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 212 224 // FIXME: what is this for? 213 225 // '(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 217 231 $this->go_to('/about/2/'); 218 232 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 ); 220 238 } 221 239 … … 229 247 // '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]', 230 248 function test_main_feed_2() { 249 $this->factory->post->create(); // @test_404 231 250 $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 232 251 … … 246 265 247 266 function test_main_feed() { 267 $this->factory->post->create(); // @test_404 248 268 $types = array('rss2', 'rss', 'atom'); 249 269 foreach ($types as $type) { … … 255 275 // 'page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]', 256 276 function test_paged() { 257 for ($i=2; $i<4; $i++) { 277 $this->factory->post->create_many( 15 ); 278 for ( $i = 2; $i <= 3; $i++ ) { 258 279 $this->go_to("/page/{$i}/"); 259 280 $this->assertQueryTrue('is_home', 'is_paged'); … … 264 285 // 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1', 265 286 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 266 290 // 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 ) ); 268 292 $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed'); 269 293 … … 283 307 284 308 } 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 292 309 293 310 // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]', … … 311 328 // 'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]', 312 329 function test_search_paged() { 330 $this->factory->post->create_many( 10, array( 'post_title' => 'test' ) ); 313 331 $this->go_to('/search/test/page/2/'); 314 332 $this->assertQueryTrue('is_search', 'is_paged'); … … 322 340 323 341 function test_search_encoded_chars() { 324 $this->knownWPBug(13961);342 // $this->knownWPBug(13961); 325 343 $this->go_to('/search/F%C3%BCnf%2Bbar/'); 326 344 $this->assertEquals( get_query_var( 's' ), 'Fünf+bar' ); … … 330 348 // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]', 331 349 function test_category_feed() { 350 $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) ); 332 351 // check the long form 333 352 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 347 366 // 'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]', 348 367 function test_category_paged() { 368 $this->factory->post->create_many( 10 ); 349 369 $this->go_to('/category/uncategorized/page/2/'); 350 370 $this->assertQueryTrue('is_archive', 'is_category', 'is_paged'); … … 353 373 // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]', 354 374 function test_category() { 375 $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) ); 355 376 $this->go_to('/category/cat-a/'); 356 377 $this->assertQueryTrue('is_archive', 'is_category'); … … 360 381 // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]', 361 382 function test_tag_feed() { 383 $this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) ); 362 384 // check the long form 363 385 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 377 399 // 'tag/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]', 378 400 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 380 405 $this->go_to('/tag/tag-a/page/2/'); 381 406 $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged'); … … 384 409 // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]', 385 410 function test_tag() { 411 $this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) ); 386 412 $this->go_to('/tag/tag-a/'); 387 413 $this->assertQueryTrue('is_archive', 'is_tag'); … … 391 417 // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]', 392 418 function test_author_feed() { 419 $this->factory->user->create( array( 'user_login' => 'user-a' ) ); 393 420 // check the long form 394 421 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 408 435 // 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]', 409 436 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 ) ); 410 439 $this->go_to('/author/user-a/page/2/'); 411 440 $this->assertQueryTrue('is_archive', 'is_author', 'is_paged'); … … 414 443 // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]', 415 444 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 ) ); 416 448 $this->go_to('/author/user-a/'); 417 449 $this->assertQueryTrue('is_archive', 'is_author'); … … 421 453 // '([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]', 422 454 function test_ymd_feed() { 455 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 423 456 // check the long form 424 457 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 438 471 // '([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]', 439 472 function test_ymd_paged() { 473 $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) ); 440 474 $this->go_to('/2007/09/04/page/2/'); 441 475 $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged'); … … 444 478 // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]', 445 479 function test_ymd() { 480 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 446 481 $this->go_to('/2007/09/04/'); 447 482 $this->assertQueryTrue('is_archive', 'is_day', 'is_date'); … … 451 486 // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]', 452 487 function test_ym_feed() { 488 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 453 489 // check the long form 454 490 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 468 504 // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]', 469 505 function test_ym_paged() { 506 $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) ); 470 507 $this->go_to('/2007/09/page/2/'); 471 508 $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged'); … … 474 511 // '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]', 475 512 function test_ym() { 513 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 476 514 $this->go_to('/2007/09/'); 477 515 $this->assertQueryTrue('is_archive', 'is_date', 'is_month'); … … 481 519 // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]', 482 520 function test_y_feed() { 521 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 483 522 // check the long form 484 523 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 498 537 // '([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]', 499 538 function test_y_paged() { 539 $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) ); 500 540 $this->go_to('/2007/page/2/'); 501 541 $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged'); … … 504 544 // '([0-9]{4})/?$' => 'index.php?year=$matches[1]', 505 545 function test_y() { 546 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 506 547 $this->go_to('/2007/'); 507 548 $this->assertQueryTrue('is_archive', 'is_date', 'is_year'); 508 549 } 509 550 510 511 551 // '([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', 512 552 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'); 518 557 } 519 558 … … 521 560 // '([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]', 522 561 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 } 549 577 } 550 578 551 579 // '([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]', 552 580 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 554 587 // and the short version 555 588 $this->go_to('/2007/09/04/a-post-with-multiple-pages/2/'); … … 561 594 // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]', 562 595 function test_post_attachment() { 563 $ this->markTestSkipped(); // @todo ID 8 is a page in Data Set 1564 $permalink = get_attachment_link( 8);596 $post_id = $this->factory->post->create( array( 'post_type' => 'attachment' ) ); 597 $permalink = get_attachment_link( $post_id ); 565 598 $this->go_to($permalink); 566 $this->assertQueryTrue('is_ attachment', 'is_singular');599 $this->assertQueryTrue('is_single', 'is_attachment', 'is_singular'); 567 600 } 568 601
Note: See TracChangeset
for help on using the changeset viewer.