Changeset 865 in tests for trunk/wp-testcase/test_query.php
- Timestamp:
- 07/02/2012 06:15:04 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/wp-testcase/test_query.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-testcase/test_query.php
r864 r865 31 31 parent::tearDown(); 32 32 $GLOBALS['wp_rewrite']->init(); 33 }34 35 function _all_post_ids( $type='post' ) {36 global $wpdb;37 return $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s and post_status='publish'", $type ) );38 33 } 39 34 … … 100 95 function test_post_comments_feed() { 101 96 $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) ); 102 // Comments aren't needed for this test to pass. 103 // $this->factory->comment->create_post_comments( $post_id, 2 ); 97 $this->factory->comment->create_post_comments( $post_id, 2 ); 98 $this->go_to( get_post_comments_feed_link( $post_id ) ); 99 $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed'); 100 } 101 102 103 function test_post_comments_feed_with_no_comments() { 104 $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) ); 104 105 $this->go_to( get_post_comments_feed_link( $post_id ) ); 105 106 $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed'); … … 162 163 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 163 164 foreach ( $page_ids as $page_id ) { 164 // Comments aren't needed for this test to pass. 165 // $this->factory->comment->create_post_comments( $page_id, 2 ); 166 165 $this->factory->comment->create_post_comments( $page_id, 2 ); 167 166 $url = get_permalink( $page_id ); 168 167 $this->go_to("{$url}feed/"); … … 175 174 $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID ); 176 175 } 177 176 } 177 178 function test_page_feed_with_no_comments() { 179 $page_ids = array(); 180 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 181 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 182 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 183 foreach ( $page_ids as $page_id ) { 184 $url = get_permalink( $page_id ); 185 $this->go_to("{$url}feed/"); 186 187 // make sure the correct wp_query flags are set 188 $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed'); 189 190 // make sure the correct page was fetched 191 global $wp_query; 192 $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID ); 193 } 178 194 } 179 195 … … 185 201 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 186 202 foreach ( $page_ids as $page_id ) { 187 // Comments aren't needed for this test to pass. 188 // $this->factory->comment->create_post_comments( $page_id, 2 ); 203 $this->factory->comment->create_post_comments( $page_id, 2 ); 189 204 190 205 $url = get_permalink( $page_id ); … … 344 359 345 360 function test_search_encoded_chars() { 346 //$this->knownWPBug(13961);361 $this->knownWPBug(13961); 347 362 $this->go_to('/search/F%C3%BCnf%2Bbar/'); 348 363 $this->assertEquals( get_query_var( 's' ), 'Fünf+bar' ); … … 406 421 foreach ( $post_ids as $post_id ) 407 422 $this->factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' ); 408 // $this->markTestSkipped(); // tag-a doesn't have enough posts -> 404409 423 $this->go_to('/tag/tag-a/page/2/'); 410 424 $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged'); … … 448 462 function test_author() { 449 463 $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) ); 450 // A post isn't needed for this test to pass. 451 // $this->factory->post->create( array( 'post_author' => $user_id ) ); 464 $this->factory->post->create( array( 'post_author' => $user_id ) ); 465 $this->go_to('/author/user-a/'); 466 $this->assertQueryTrue('is_archive', 'is_author'); 467 } 468 469 function test_author_with_no_posts() { 470 $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) ); 452 471 $this->go_to('/author/user-a/'); 453 472 $this->assertQueryTrue('is_archive', 'is_author'); … … 588 607 'post_content' => 'Page 1 <!--nextpage--> Page 2' 589 608 ) ); 590 // $this->markTestSkipped(); // @todo post doesn't exist in Data Set 1591 // and the short version592 609 $this->go_to('/2007/09/04/a-post-with-multiple-pages/2/'); 593 610 // should is_paged be true also?
Note: See TracChangeset
for help on using the changeset viewer.