Changeset 47122 for trunk/tests/phpunit/tests/query/conditionals.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/query/conditionals.php (modified) (35 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/conditionals.php
r46586 r47122 188 188 $this->go_to( "{$url}trackback/" ); 189 189 190 // make sure the correct wp_query flags are set190 // Make sure the correct WP_Query flags are set. 191 191 $this->assertQueryTrue( 'is_page', 'is_singular', 'is_trackback' ); 192 192 193 // make sure the correct page was fetched193 // Make sure the correct page was fetched. 194 194 global $wp_query; 195 195 $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID ); … … 197 197 } 198 198 199 // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'199 // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]' 200 200 function test_page_feed() { 201 201 $page_ids = array(); … … 227 227 $this->go_to( "{$url}feed/" ); 228 228 229 // make sure the correct wp_query flags are set229 // Make sure the correct WP_Query flags are set. 230 230 $this->assertQueryTrue( 'is_page', 'is_singular', 'is_feed', 'is_comment_feed' ); 231 231 232 // make sure the correct page was fetched232 // Make sure the correct page was fetched. 233 233 global $wp_query; 234 234 $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID ); … … 264 264 $this->go_to( "{$url}feed/" ); 265 265 266 // make sure the correct wp_query flags are set266 // Make sure the correct WP_Query flags are set. 267 267 $this->assertQueryTrue( 'is_page', 'is_singular', 'is_feed', 'is_comment_feed' ); 268 268 269 // make sure the correct page was fetched269 // Make sure the correct page was fetched. 270 270 global $wp_query; 271 271 $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID ); … … 304 304 $this->go_to( "{$url}feed/atom/" ); 305 305 306 // make sure the correct wp_query flags are set306 // Make sure the correct WP_Query flags are set. 307 307 $this->assertQueryTrue( 'is_page', 'is_singular', 'is_feed', 'is_comment_feed' ); 308 308 309 // make sure the correct page was fetched309 // Make sure the correct page was fetched. 310 310 global $wp_query; 311 311 $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID ); … … 324 324 $this->go_to( '/about/page/2/' ); 325 325 326 // make sure the correct wp_query flags are set326 // Make sure the correct WP_Query flags are set. 327 327 $this->assertQueryTrue( 'is_page', 'is_singular', 'is_paged' ); 328 328 329 // make sure the correct page was fetched329 // Make sure the correct page was fetched. 330 330 global $wp_query; 331 331 $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID ); … … 343 343 $this->go_to( '/about/page2/' ); 344 344 345 // make sure the correct wp_query flags are set345 // Make sure the correct WP_Query flags are set. 346 346 $this->assertQueryTrue( 'is_page', 'is_singular', 'is_paged' ); 347 347 348 // make sure the correct page was fetched348 // Make sure the correct page was fetched. 349 349 global $wp_query; 350 350 $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID ); … … 367 367 $this->assertQueryTrue( 'is_home', 'is_posts_page' ); 368 368 369 // make sure the correct page was fetched369 // Make sure the correct page was fetched. 370 370 global $wp_query; 371 371 $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID ); … … 375 375 } 376 376 377 // FIXME: no tests for these yet 377 // FIXME: no tests for these yet: 378 378 // 'about/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]', 379 379 // 'about/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1', … … 387 387 $feeds = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 388 388 389 // long version389 // Long version. 390 390 foreach ( $feeds as $feed ) { 391 391 $this->go_to( "/feed/{$feed}/" ); … … 393 393 } 394 394 395 // short version395 // Short version. 396 396 foreach ( $feeds as $feed ) { 397 397 $this->go_to( "/{$feed}/" ); … … 426 426 self::factory()->comment->create_post_comments( $post_id, 2 ); 427 427 428 // check the url as generated by get_post_comments_feed_link()428 // Check the URL as generated by get_post_comments_feed_link(). 429 429 $this->go_to( get_post_comments_feed_link( $post_id ) ); 430 430 $this->assertQueryTrue( 'is_feed', 'is_single', 'is_singular', 'is_comment_feed' ); 431 431 432 // check the long form432 // Check the long form. 433 433 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 434 434 foreach ( $types as $type ) { … … 437 437 } 438 438 439 // check the short form439 // Check the short form. 440 440 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 441 441 foreach ( $types as $type ) { … … 449 449 // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]', 450 450 function test_search_feed() { 451 // check the long form451 // Check the long form. 452 452 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 453 453 foreach ( $types as $type ) { … … 456 456 } 457 457 458 // check the short form458 // Сheck the short form. 459 459 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 460 460 foreach ( $types as $type ) { … … 496 496 ); 497 497 498 // check the long form498 // Check the long form. 499 499 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 500 500 foreach ( $types as $type ) { … … 503 503 } 504 504 505 // check the short form505 // Check the short form. 506 506 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 507 507 foreach ( $types as $type ) { … … 540 540 ) 541 541 ); 542 // check the long form542 // Check the long form. 543 543 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 544 544 foreach ( $types as $type ) { … … 547 547 } 548 548 549 // check the short form549 // Check the short form. 550 550 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 551 551 foreach ( $types as $type ) { … … 594 594 function test_author_feed() { 595 595 self::factory()->user->create( array( 'user_login' => 'user-a' ) ); 596 // check the long form596 // Check the long form. 597 597 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 598 598 foreach ( $types as $type ) { … … 601 601 } 602 602 603 // check the short form603 // Check the short form. 604 604 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 605 605 foreach ( $types as $type ) { … … 636 636 function test_ymd_feed() { 637 637 self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 638 // check the long form638 // Check the long form. 639 639 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 640 640 foreach ( $types as $type ) { … … 643 643 } 644 644 645 // check the short form645 // Check the short form. 646 646 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 647 647 foreach ( $types as $type ) { … … 670 670 function test_ym_feed() { 671 671 self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 672 // check the long form672 // Check the long form. 673 673 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 674 674 foreach ( $types as $type ) { … … 677 677 } 678 678 679 // check the short form679 // Check the short form. 680 680 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 681 681 foreach ( $types as $type ) { … … 704 704 function test_y_feed() { 705 705 self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 706 // check the long form706 // Check the long form. 707 707 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 708 708 foreach ( $types as $type ) { … … 711 711 } 712 712 713 // check the short form713 // Check the short form. 714 714 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 715 715 foreach ( $types as $type ) { … … 747 747 $post_id = self::factory()->post->create(); 748 748 $permalink = get_permalink( $post_id ); 749 749 // Check the long form. 750 750 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 751 751 foreach ( $types as $type ) { … … 754 754 } 755 755 756 // check the short form756 // Check the short form. 757 757 $types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 758 758 foreach ( $types as $type ) { … … 772 772 ); 773 773 $this->go_to( get_permalink( $post_id ) . '2/' ); 774 // should is_paged be true also?774 // Should is_paged be true also? 775 775 $this->assertQueryTrue( 'is_single', 'is_singular' ); 776 776 … … 902 902 */ 903 903 function test_is_single_with_parent() { 904 // Use custom hierarchical post type 904 // Use custom hierarchical post type. 905 905 $post_type = 'test_hierarchical'; 906 906 … … 915 915 ); 916 916 917 // Create parent and child posts 917 // Create parent and child posts. 918 918 $parent_id = self::factory()->post->create( 919 919 array( … … 931 931 ); 932 932 933 // Tests 933 // Tests. 934 934 $this->go_to( "/?p=$post_id&post_type=$post_type" ); 935 935 … … 1200 1200 $this->go_to( "/?page_id=$post_id" ); 1201 1201 1202 // override post ID to 0 temporarily for testing1202 // Override post ID to 0 temporarily for testing. 1203 1203 $_id = $GLOBALS['wp_query']->post->ID; 1204 1204 $GLOBALS['wp_query']->post->ID = 0; … … 1211 1211 $this->assertFalse( $q->is_page( 'random-page-slug' ) ); 1212 1212 1213 // revert $wp_query global change1213 // Revert $wp_query global change. 1214 1214 $GLOBALS['wp_query']->post->ID = $_id; 1215 1215 }
Note: See TracChangeset
for help on using the changeset viewer.