Changeset 35225 for trunk/tests/phpunit/tests/query/conditionals.php
- Timestamp:
- 10/16/2015 09:04:12 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/query/conditionals.php (modified) (59 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/conditionals.php
r35196 r35225 46 46 47 47 function test_permalink() { 48 $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );48 $post_id = self::$factory->post->create( array( 'post_title' => 'hello-world' ) ); 49 49 $this->go_to( get_permalink( $post_id ) ); 50 50 $this->assertQueryTrue('is_single', 'is_singular'); … … 52 52 53 53 function test_post_comments_feed() { 54 $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );55 $this->factory->comment->create_post_comments( $post_id, 2 );54 $post_id = self::$factory->post->create( array( 'post_title' => 'hello-world' ) ); 55 self::$factory->comment->create_post_comments( $post_id, 2 ); 56 56 $this->go_to( get_post_comments_feed_link( $post_id ) ); 57 57 $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed'); … … 60 60 61 61 function test_post_comments_feed_with_no_comments() { 62 $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );62 $post_id = self::$factory->post->create( array( 'post_title' => 'hello-world' ) ); 63 63 $this->go_to( get_post_comments_feed_link( $post_id ) ); 64 64 $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed'); … … 66 66 67 67 function test_page() { 68 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );68 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) ); 69 69 $this->go_to( get_permalink( $page_id ) ); 70 70 $this->assertQueryTrue('is_page','is_singular'); … … 72 72 73 73 function test_parent_page() { 74 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );74 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 75 75 $this->go_to( get_permalink( $page_id ) ); 76 76 … … 79 79 80 80 function test_child_page_1() { 81 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );82 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );81 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 82 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 83 83 $this->go_to( get_permalink( $page_id ) ); 84 84 … … 87 87 88 88 function test_child_page_2() { 89 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );90 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );91 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );89 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 90 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 91 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 92 92 $this->go_to( get_permalink( $page_id ) ); 93 93 … … 98 98 function test_page_trackback() { 99 99 $page_ids = array(); 100 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );101 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );102 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );100 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 101 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 102 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 103 103 foreach ( $page_ids as $page_id ) { 104 104 $url = get_permalink( $page_id ); … … 117 117 function test_page_feed() { 118 118 $page_ids = array(); 119 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );120 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );121 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );119 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 120 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 121 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 122 122 foreach ( $page_ids as $page_id ) { 123 $this->factory->comment->create_post_comments( $page_id, 2 );123 self::$factory->comment->create_post_comments( $page_id, 2 ); 124 124 $url = get_permalink( $page_id ); 125 125 $this->go_to("{$url}feed/"); … … 136 136 function test_page_feed_with_no_comments() { 137 137 $page_ids = array(); 138 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );139 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );140 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );138 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 139 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 140 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 141 141 foreach ( $page_ids as $page_id ) { 142 142 $url = get_permalink( $page_id ); … … 155 155 function test_page_feed_atom() { 156 156 $page_ids = array(); 157 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );158 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );159 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );157 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 158 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 159 $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 160 160 foreach ( $page_ids as $page_id ) { 161 $this->factory->comment->create_post_comments( $page_id, 2 );161 self::$factory->comment->create_post_comments( $page_id, 2 ); 162 162 163 163 $url = get_permalink( $page_id ); … … 175 175 // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]' 176 176 function test_page_page_2() { 177 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );177 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) ); 178 178 $this->go_to("/about/page/2/"); 179 179 … … 188 188 // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]' 189 189 function test_page_page_2_no_slash() { 190 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );190 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) ); 191 191 $this->go_to("/about/page2/"); 192 192 … … 202 202 // '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]' 203 203 function test_pagination_of_posts_page() { 204 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );204 $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) ); 205 205 update_option( 'show_on_front', 'page' ); 206 206 update_option( 'page_for_posts', $page_id ); … … 224 224 // '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]', 225 225 function test_main_feed_2() { 226 $this->factory->post->create(); // @test_404226 self::$factory->post->create(); // @test_404 227 227 $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 228 228 … … 242 242 243 243 function test_main_feed() { 244 $this->factory->post->create(); // @test_404244 self::$factory->post->create(); // @test_404 245 245 $types = array('rss2', 'rss', 'atom'); 246 246 foreach ($types as $type) { … … 253 253 function test_paged() { 254 254 update_option( 'posts_per_page', 2 ); 255 $this->factory->post->create_many( 5 );255 self::$factory->post->create_many( 5 ); 256 256 for ( $i = 2; $i <= 3; $i++ ) { 257 257 $this->go_to("/page/{$i}/"); … … 263 263 // 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1', 264 264 function test_main_comments_feed() { 265 $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );266 $this->factory->comment->create_post_comments( $post_id, 2 );265 $post_id = self::$factory->post->create( array( 'post_title' => 'hello-world' ) ); 266 self::$factory->comment->create_post_comments( $post_id, 2 ); 267 267 268 268 // check the url as generated by get_post_comments_feed_link() … … 307 307 function test_search_paged() { 308 308 update_option( 'posts_per_page', 2 ); 309 $this->factory->post->create_many( 3, array( 'post_title' => 'test' ) );309 self::$factory->post->create_many( 3, array( 'post_title' => 'test' ) ); 310 310 $this->go_to('/search/test/page/2/'); 311 311 $this->assertQueryTrue('is_search', 'is_paged'); … … 329 329 // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]', 330 330 function test_category_feed() { 331 $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );331 self::$factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) ); 332 332 // check the long form 333 333 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 348 348 function test_category_paged() { 349 349 update_option( 'posts_per_page', 2 ); 350 $this->factory->post->create_many( 3 );350 self::$factory->post->create_many( 3 ); 351 351 $this->go_to('/category/uncategorized/page/2/'); 352 352 $this->assertQueryTrue('is_archive', 'is_category', 'is_paged'); … … 355 355 // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]', 356 356 function test_category() { 357 $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );357 self::$factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) ); 358 358 $this->go_to('/category/cat-a/'); 359 359 $this->assertQueryTrue('is_archive', 'is_category'); … … 363 363 // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]', 364 364 function test_tag_feed() { 365 $this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );365 self::$factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) ); 366 366 // check the long form 367 367 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 382 382 function test_tag_paged() { 383 383 update_option( 'posts_per_page', 2 ); 384 $post_ids = $this->factory->post->create_many( 3 );384 $post_ids = self::$factory->post->create_many( 3 ); 385 385 foreach ( $post_ids as $post_id ) 386 $this->factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );386 self::$factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' ); 387 387 $this->go_to('/tag/tag-a/page/2/'); 388 388 $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged'); … … 391 391 // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]', 392 392 function test_tag() { 393 $term_id = $this->factory->term->create( array( 'name' => 'Tag Named A', 'slug' => 'tag-a', 'taxonomy' => 'post_tag' ) );393 $term_id = self::$factory->term->create( array( 'name' => 'Tag Named A', 'slug' => 'tag-a', 'taxonomy' => 'post_tag' ) ); 394 394 $this->go_to('/tag/tag-a/'); 395 395 $this->assertQueryTrue('is_archive', 'is_tag'); … … 410 410 // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]', 411 411 function test_author_feed() { 412 $this->factory->user->create( array( 'user_login' => 'user-a' ) );412 self::$factory->user->create( array( 'user_login' => 'user-a' ) ); 413 413 // check the long form 414 414 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 429 429 function test_author_paged() { 430 430 update_option( 'posts_per_page', 2 ); 431 $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );432 $this->factory->post->create_many( 3, array( 'post_author' => $user_id ) );431 $user_id = self::$factory->user->create( array( 'user_login' => 'user-a' ) ); 432 self::$factory->post->create_many( 3, array( 'post_author' => $user_id ) ); 433 433 $this->go_to('/author/user-a/page/2/'); 434 434 $this->assertQueryTrue('is_archive', 'is_author', 'is_paged'); … … 437 437 // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]', 438 438 function test_author() { 439 $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );440 $this->factory->post->create( array( 'post_author' => $user_id ) );439 $user_id = self::$factory->user->create( array( 'user_login' => 'user-a' ) ); 440 self::$factory->post->create( array( 'post_author' => $user_id ) ); 441 441 $this->go_to('/author/user-a/'); 442 442 $this->assertQueryTrue('is_archive', 'is_author'); … … 444 444 445 445 function test_author_with_no_posts() { 446 $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );446 $user_id = self::$factory->user->create( array( 'user_login' => 'user-a' ) ); 447 447 $this->go_to('/author/user-a/'); 448 448 $this->assertQueryTrue('is_archive', 'is_author'); … … 452 452 // '([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]', 453 453 function test_ymd_feed() { 454 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );454 self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 455 455 // check the long form 456 456 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 471 471 function test_ymd_paged() { 472 472 update_option( 'posts_per_page', 2 ); 473 $this->factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );473 self::$factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) ); 474 474 $this->go_to('/2007/09/04/page/2/'); 475 475 $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged'); … … 478 478 // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]', 479 479 function test_ymd() { 480 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );480 self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 481 481 $this->go_to('/2007/09/04/'); 482 482 $this->assertQueryTrue('is_archive', 'is_day', 'is_date'); … … 486 486 // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]', 487 487 function test_ym_feed() { 488 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );488 self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 489 489 // check the long form 490 490 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 505 505 function test_ym_paged() { 506 506 update_option( 'posts_per_page', 2 ); 507 $this->factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );507 self::$factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) ); 508 508 $this->go_to('/2007/09/page/2/'); 509 509 $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged'); … … 512 512 // '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]', 513 513 function test_ym() { 514 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );514 self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 515 515 $this->go_to('/2007/09/'); 516 516 $this->assertQueryTrue('is_archive', 'is_date', 'is_month'); … … 520 520 // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]', 521 521 function test_y_feed() { 522 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );522 self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 523 523 // check the long form 524 524 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 539 539 function test_y_paged() { 540 540 update_option( 'posts_per_page', 2 ); 541 $this->factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );541 self::$factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) ); 542 542 $this->go_to('/2007/page/2/'); 543 543 $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged'); … … 546 546 // '([0-9]{4})/?$' => 'index.php?year=$matches[1]', 547 547 function test_y() { 548 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );548 self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 549 549 $this->go_to('/2007/'); 550 550 $this->assertQueryTrue('is_archive', 'is_date', 'is_year'); … … 553 553 // '([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', 554 554 function test_post_trackback() { 555 $post_id = $this->factory->post->create();555 $post_id = self::$factory->post->create(); 556 556 $permalink = get_permalink( $post_id ); 557 557 $this->go_to("{$permalink}trackback/"); … … 562 562 // '([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]', 563 563 function test_post_comment_feed() { 564 $post_id = $this->factory->post->create();564 $post_id = self::$factory->post->create(); 565 565 $permalink = get_permalink( $post_id ); 566 566 … … 581 581 // '([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]', 582 582 function test_post_paged_short() { 583 $post_id = $this->factory->post->create( array(583 $post_id = self::$factory->post->create( array( 584 584 'post_date' => '2007-09-04 00:00:00', 585 585 'post_title' => 'a-post-with-multiple-pages', … … 594 594 // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]', 595 595 function test_post_attachment() { 596 $post_id = $this->factory->post->create( array( 'post_type' => 'attachment' ) );596 $post_id = self::$factory->post->create( array( 'post_type' => 'attachment' ) ); 597 597 $permalink = get_attachment_link( $post_id ); 598 598 $this->go_to($permalink); … … 630 630 ) ); 631 631 632 $tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) );633 $post_id = $this->factory->post->create( array( 'post_type' => $cpt_name ) );632 $tag_id = self::$factory->tag->create( array( 'slug' => 'tag-slug' ) ); 633 $post_id = self::$factory->post->create( array( 'post_type' => $cpt_name ) ); 634 634 wp_set_object_terms( $post_id, $tag_id, 'post_tag' ); 635 635 … … 664 664 'public' => true 665 665 ) ); 666 $this->factory->post->create( array( 'post_type' => $cpt_name ) );666 self::$factory->post->create( array( 'post_type' => $cpt_name ) ); 667 667 668 668 $this->go_to( "/$cpt_name/" ); … … 684 684 685 685 function test_is_single() { 686 $post_id = $this->factory->post->create();686 $post_id = self::$factory->post->create(); 687 687 $this->go_to( "/?p=$post_id" ); 688 688 … … 715 715 716 716 // Create parent and child posts 717 $parent_id = $this->factory->post->create( array(717 $parent_id = self::$factory->post->create( array( 718 718 'post_type' => $post_type, 719 719 'post_name' => 'foo' 720 720 ) ); 721 721 722 $post_id = $this->factory->post->create( array(722 $post_id = self::$factory->post->create( array( 723 723 'post_type' => $post_type, 724 724 'post_name' => 'bar', … … 751 751 */ 752 752 public function test_is_single_with_slug_that_begins_with_a_number_that_clashes_with_another_post_id() { 753 $p1 = $this->factory->post->create();753 $p1 = self::$factory->post->create(); 754 754 755 755 $p2_name = $p1 . '-post'; 756 $p2 = $this->factory->post->create( array(756 $p2 = self::$factory->post->create( array( 757 757 'slug' => $p2_name, 758 758 ) ); … … 769 769 770 770 function test_is_page() { 771 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );771 $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) ); 772 772 $this->go_to( "/?page_id=$post_id" ); 773 773 … … 789 789 */ 790 790 function test_is_page_with_parent() { 791 $parent_id = $this->factory->post->create( array(791 $parent_id = self::$factory->post->create( array( 792 792 'post_type' => 'page', 793 793 'post_name' => 'foo', 794 794 ) ); 795 $post_id = $this->factory->post->create( array(795 $post_id = self::$factory->post->create( array( 796 796 'post_type' => 'page', 797 797 'post_name' => 'bar', … … 819 819 820 820 function test_is_attachment() { 821 $post_id = $this->factory->post->create( array( 'post_type' => 'attachment' ) );821 $post_id = self::$factory->post->create( array( 'post_type' => 'attachment' ) ); 822 822 $this->go_to( "/?attachment_id=$post_id" ); 823 823 … … 840 840 */ 841 841 public function test_is_attachment_with_slug_that_begins_with_a_number_that_clashes_with_a_page_ID() { 842 $p1 = $this->factory->post->create( array( 'post_type' => 'attachment' ) );842 $p1 = self::$factory->post->create( array( 'post_type' => 'attachment' ) ); 843 843 844 844 $p2_name = $p1 . '-attachment'; 845 $p2 = $this->factory->post->create( array(845 $p2 = self::$factory->post->create( array( 846 846 'post_type' => 'attachment', 847 847 'post_name' => $p2_name, … … 862 862 */ 863 863 public function test_is_author_with_nicename_that_begins_with_a_number_that_clashes_with_another_author_id() { 864 $u1 = $this->factory->user->create();864 $u1 = self::$factory->user->create(); 865 865 866 866 $u2_name = $u1 . '_user'; 867 $u2 = $this->factory->user->create( array(867 $u2 = self::$factory->user->create( array( 868 868 'user_nicename' => $u2_name, 869 869 ) ); … … 883 883 */ 884 884 public function test_is_category_with_slug_that_begins_with_a_number_that_clashes_with_another_category_id() { 885 $c1 = $this->factory->category->create();885 $c1 = self::$factory->category->create(); 886 886 887 887 $c2_name = $c1 . '-category'; 888 $c2 = $this->factory->category->create( array(888 $c2 = self::$factory->category->create( array( 889 889 'slug' => $c2_name, 890 890 ) ); … … 904 904 */ 905 905 public function test_is_tag_with_slug_that_begins_with_a_number_that_clashes_with_another_tag_id() { 906 $t1 = $this->factory->tag->create();906 $t1 = self::$factory->tag->create(); 907 907 908 908 $t2_name = $t1 . '-tag'; 909 $t2 = $this->factory->tag->create( array(909 $t2 = self::$factory->tag->create( array( 910 910 'slug' => $t2_name, 911 911 ) ); … … 925 925 */ 926 926 public function test_is_page_with_page_id_zero_and_random_page_slug() { 927 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );927 $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) ); 928 928 $this->go_to( "/?page_id=$post_id" ); 929 929 … … 947 947 */ 948 948 public function test_is_page_with_page_slug_that_begins_with_a_number_that_clashes_with_a_page_ID() { 949 $p1 = $this->factory->post->create( array( 'post_type' => 'page' ) );949 $p1 = self::$factory->post->create( array( 'post_type' => 'page' ) ); 950 950 951 951 $p2_name = $p1 . '-page'; 952 $p2 = $this->factory->post->create( array(952 $p2 = self::$factory->post->create( array( 953 953 'post_type' => 'page', 954 954 'post_name' => $p2_name, … … 966 966 967 967 function test_is_page_template() { 968 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );968 $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) ); 969 969 update_post_meta($post_id, '_wp_page_template', 'example.php'); 970 970 $this->go_to( "/?page_id=$post_id" ); … … 976 976 */ 977 977 function test_is_page_template_default() { 978 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );978 $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) ); 979 979 $this->go_to( "/?page_id=$post_id" ); 980 980 $this->assertTrue( is_page_template( 'default' ) ); … … 986 986 */ 987 987 function test_is_page_template_array() { 988 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );988 $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) ); 989 989 update_post_meta($post_id, '_wp_page_template', 'example.php'); 990 990 $this->go_to( "/?page_id=$post_id" );
Note: See TracChangeset
for help on using the changeset viewer.