Changeset 5947
- Timestamp:
- 10/27/2015 01:07:53 PM (10 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 11 edited
-
includes/testcase.php (modified) (3 diffs)
-
testcases/forums/functions/forum.php (modified) (1 diff)
-
testcases/forums/template/feeds.php (modified) (2 diffs)
-
testcases/forums/template/forum.php (modified) (9 diffs)
-
testcases/forums/template/get-last-thing.php (modified) (2 diffs)
-
testcases/replies/functions/reply.php (modified) (2 diffs)
-
testcases/replies/template/reply.php (modified) (1 diff)
-
testcases/topics/functions/topic.php (modified) (2 diffs)
-
testcases/topics/template/links.php (modified) (2 diffs)
-
testcases/topics/template/topic.php (modified) (3 diffs)
-
testcases/users/template/user.php (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r5770 r5947 34 34 $this->bp_factory = new BP_UnitTest_Factory(); 35 35 } 36 37 // Our default is ugly permalinks, so reset when needed. 38 global $wp_rewrite; 39 if ( $wp_rewrite->permalink_structure ) { 40 $this->set_permalink_structure(); 41 } 36 42 } 37 43 … … 325 331 if ( ! empty( self::$cached_SERVER_NAME ) ) { 326 332 $_SERVER['SERVER_NAME'] = self::$cached_SERVER_NAME; 327 unset( $this->cached_SERVER_NAME );333 self::$cached_SERVER_NAME = ''; 328 334 } else { 329 335 unset( $_SERVER['SERVER_NAME'] ); … … 341 347 $wpdb->query( 'COMMIT;' ); 342 348 } 349 350 /** 351 * Utility method that resets permalinks and flushes rewrites. 352 * 353 * @since 2.6.0 bbPress (r5947) 354 * 355 * @global WP_Rewrite $wp_rewrite 356 * 357 * @uses WP_UnitTestCase::set_permalink_structure() 358 * 359 * @param string $structure Optional. Permalink structure to set. Default empty. 360 */ 361 public function set_permalink_structure( $structure = '' ) { 362 363 // Use WP 4.4+'s version if it exists. 364 if ( method_exists( 'parent', 'set_permalink_structure' ) ) { 365 parent::set_permalink_structure( $structure ); 366 } else { 367 global $wp_rewrite; 368 369 $wp_rewrite->init(); 370 $wp_rewrite->set_permalink_structure( $structure ); 371 $wp_rewrite->flush_rules(); 372 } 373 } 343 374 } -
trunk/tests/phpunit/testcases/forums/functions/forum.php
r5925 r5947 16 16 public function test_bbp_insert_forum() { 17 17 18 $f = $this->factory->forum->create(); 18 $f = $this->factory->forum->create( array( 19 'post_title' => 'Forum 1', 20 'post_content' => 'Content of Forum 1', 21 ) ); 19 22 20 23 $now = time(); -
trunk/tests/phpunit/testcases/forums/template/feeds.php
r5914 r5947 20 20 } 21 21 22 $f = $this->factory->forum->create(); 22 $f = $this->factory->forum->create( array( 23 'post_title' => 'Forum 1', 24 ) ); 23 25 24 26 $feed_link = bbp_get_forum_topics_feed_link( $f ); … … 40 42 } 41 43 42 $f = $this->factory->forum->create(); 44 $f = $this->factory->forum->create( array( 45 'post_title' => 'Forum 1', 46 ) ); 43 47 44 48 $feed_link = bbp_get_forum_replies_feed_link( $f ); -
trunk/tests/phpunit/testcases/forums/template/forum.php
r5880 r5947 42 42 } 43 43 44 $f = $this->factory->forum->create(); 44 $f = $this->factory->forum->create( array( 45 'post_title' => 'Forum 1', 46 ) ); 45 47 46 48 $forum_permalink = bbp_get_forum_permalink( $f ); … … 57 59 */ 58 60 public function test_bbp_get_forum_title() { 59 $f = $this->factory->forum->create(); 61 $f = $this->factory->forum->create( array( 62 'post_title' => 'Forum 1', 63 ) ); 60 64 61 65 $forum = bbp_get_forum_title( $f ); … … 81 85 */ 82 86 public function test_bbp_get_forum_content() { 83 $f = $this->factory->forum->create(); 87 $f = $this->factory->forum->create( array( 88 'post_content' => 'Content of Forum 1', 89 ) ); 84 90 85 91 $forum = bbp_get_forum_content( $f ); … … 106 112 107 113 $t = $this->factory->topic->create( array( 114 'post_title' => 'Topic 1', 108 115 'post_parent' => $f, 109 116 'post_date' => $post_date, … … 139 146 140 147 $t1 = $this->factory->topic->create( array( 148 'post_title' => 'Topic 1', 141 149 'post_parent' => $f, 142 150 'post_date' => $post_date_t1, … … 150 158 151 159 $t2 = $this->factory->topic->create( array( 160 'post_title' => 'Topic 2', 152 161 'post_parent' => $f, 153 162 'post_date' => $post_date_t2, … … 166 175 167 176 $t3 = $this->factory->topic->create( array( 177 'post_title' => 'Topic 3', 168 178 'post_parent' => $f, 169 179 'post_date' => $post_date_t3, … … 183 193 184 194 $t4 = $this->factory->topic->create( array( 195 'post_title' => 'Topic 4', 185 196 'post_parent' => $f, 186 197 'post_date' => $post_date_t4, … … 215 226 216 227 $t5 = $this->factory->topic->create( array( 228 'post_title' => 'Topic 5', 217 229 'post_parent' => $f, 218 230 'post_date' => $post_date_t5, -
trunk/tests/phpunit/testcases/forums/template/get-last-thing.php
r5874 r5947 187 187 188 188 $t = $this->factory->topic->create( array( 189 'post_title' => 'Topic 1', 189 190 'post_parent' => $f, 190 191 'topic_meta' => array( … … 340 341 341 342 $this->factory->reply->create( array( 343 'post_title' => 'Reply To: Topic 1', 342 344 'post_parent' => $t, 343 345 'reply_meta' => array( -
trunk/tests/phpunit/testcases/replies/functions/reply.php
r5925 r5947 26 26 27 27 $r = $this->factory->reply->create( array( 28 'post_title' => 'Reply To: Topic 1', 29 'post_content' => 'Content of reply to Topic 1', 28 30 'post_parent' => $t, 29 31 'reply_meta' => array( … … 36 38 $reply = bbp_get_reply( $r ); 37 39 40 remove_all_filters( 'bbp_get_reply_content' ); 41 38 42 // Reply post. 39 43 $this->assertSame( 'Reply To: Topic 1', bbp_get_reply_title( $r ) ); 44 $this->assertSame( 'Content of reply to Topic 1', bbp_get_reply_content( $r ) ); 40 45 $this->assertSame( 'publish', bbp_get_reply_status( $r ) ); 41 46 $this->assertSame( $t, wp_get_post_parent_id( $r ) ); -
trunk/tests/phpunit/testcases/replies/template/reply.php
r5896 r5947 261 261 262 262 $r = $this->factory->reply->create( array( 263 'post_content' => 'Content of Reply 1', 263 264 'post_parent' => $t, 264 265 'reply_meta' => array( -
trunk/tests/phpunit/testcases/topics/functions/topic.php
r5925 r5947 22 22 23 23 $t = $this->factory->topic->create( array( 24 'post_title' => 'Topic 1', 25 'post_content' => 'Content for Topic 1', 24 26 'post_parent' => $f, 25 27 'post_date' => $post_date, … … 41 43 $topic = bbp_get_topic( $t ); 42 44 45 remove_all_filters( 'bbp_get_topic_content' ); 46 43 47 // Topic post. 44 48 $this->assertSame( 'Topic 1', bbp_get_topic_title( $t ) ); 49 $this->assertSame( 'Content for Topic 1', bbp_get_topic_content( $t ) ); 45 50 $this->assertSame( 'publish', bbp_get_topic_status( $t ) ); 46 51 $this->assertSame( $f, wp_get_post_parent_id( $t ) ); -
trunk/tests/phpunit/testcases/topics/template/links.php
r5914 r5947 51 51 $f = $this->factory->forum->create(); 52 52 $t = $this->factory->topic->create( array( 53 'post_title' => 'Topic 1', 53 54 'post_parent' => $f, 54 55 'post_date' => $post_date, … … 105 106 $f = $this->factory->forum->create(); 106 107 $t = $this->factory->topic->create( array( 108 'post_title' => 'Topic 1', 107 109 'post_parent' => $f, 108 110 'post_date' => $post_date, -
trunk/tests/phpunit/testcases/topics/template/topic.php
r5879 r5947 58 58 $f = $this->factory->forum->create(); 59 59 $t = $this->factory->topic->create( array( 60 'post_title' => 'Topic 1', 60 61 'post_parent' => $f, 61 62 'topic_meta' => array( … … 79 80 $f = $this->factory->forum->create(); 80 81 $t = $this->factory->topic->create( array( 82 'post_title' => 'Topic 1', 81 83 'post_parent' => $f, 82 84 'topic_meta' => array( … … 108 110 $f = $this->factory->forum->create(); 109 111 $t = $this->factory->topic->create( array( 112 'post_content' => 'Content of Topic 1', 110 113 'post_parent' => $f, 111 114 'topic_meta' => array( -
trunk/tests/phpunit/testcases/users/template/user.php
r5946 r5947 25 25 } 26 26 27 private function set_permalink_structure( $permalink_structure = '/%year%/%monthnum%/%day%/%postname%/' ) {28 global $wp_rewrite;29 $wp_rewrite->set_permalink_structure( $permalink_structure );30 }31 32 27 /** 33 28 * @covers ::bbp_user_id … … 130 125 131 126 // Pretty permalinks 132 $this->set_permalink_structure( );127 $this->set_permalink_structure( '/%postname%/' ); 133 128 134 129 $profile_link = '<a href="http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/" rel="nofollow">' . $display_name . '</a>'; … … 145 140 146 141 // Ugly permalinks 147 $this->set_permalink_structure( '');142 $this->set_permalink_structure(); 148 143 149 144 $profile_link = '<a href="http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '" rel="nofollow">' . $display_name . '</a>'; … … 180 175 181 176 // Pretty permalinks 182 $this->set_permalink_structure( );177 $this->set_permalink_structure( '/%postname%/' ); 183 178 $profile_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/'; 184 179 $user_profile_url = bbp_get_user_profile_url( $this->keymaster_id ); … … 194 189 195 190 // Ugly permalinks 196 $this->set_permalink_structure( '');191 $this->set_permalink_structure(); 197 192 198 193 $profile_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id; … … 215 210 216 211 // Pretty permalinks 217 $this->set_permalink_structure( );212 $this->set_permalink_structure( '/%postname%/' ); 218 213 $profile_edit_link = '<a href="http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/edit/" rel="nofollow">' . $display_name . '</a>'; 219 214 $user_profile_edit_link = bbp_get_user_profile_edit_link( $this->keymaster_id ); … … 229 224 230 225 // Ugly permalinks 231 $this->set_permalink_structure( '');226 $this->set_permalink_structure(); 232 227 $profile_edit_link = '<a href="http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&edit=1" rel="nofollow">' . $display_name . '</a>'; 233 228 $user_profile_edit_link = bbp_get_user_profile_edit_link( $this->keymaster_id ); … … 247 242 248 243 // Pretty permalinks 249 $this->set_permalink_structure( );244 $this->set_permalink_structure( '/%postname%/' ); 250 245 $profile_edit_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/edit/'; 251 246 … … 257 252 258 253 // Ugly permalinks 259 $this->set_permalink_structure( '');254 $this->set_permalink_structure(); 260 255 $profile_edit_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&edit=1'; 261 256 … … 271 266 272 267 // Pretty permalinks 273 $this->set_permalink_structure( );268 $this->set_permalink_structure( '/%postname%/' ); 274 269 $profile_edit_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/edit/'; 275 270 … … 278 273 279 274 // Ugly permalinks 280 $this->set_permalink_structure( '');275 $this->set_permalink_structure(); 281 276 $profile_edit_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&edit=1'; 282 277 … … 376 371 377 372 // Pretty permalinks 378 $this->set_permalink_structure( );373 $this->set_permalink_structure( '/%postname%/' ); 379 374 $favorites_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/favorites/'; 380 375 … … 386 381 387 382 // Ugly permalinks 388 $this->set_permalink_structure( '');383 $this->set_permalink_structure(); 389 384 $favorites_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&bbp_favs=favorites'; 390 385 … … 400 395 401 396 // Pretty permalinks 402 $this->set_permalink_structure( );397 $this->set_permalink_structure( '/%postname%/' ); 403 398 $favorites_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/favorites/'; 404 399 … … 407 402 408 403 // Ugly permalinks 409 $this->set_permalink_structure( '');404 $this->set_permalink_structure(); 410 405 $favorites_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&bbp_favs=favorites'; 411 406 … … 432 427 433 428 // Pretty permalinks 434 $this->set_permalink_structure( );429 $this->set_permalink_structure( '/%postname%/' ); 435 430 $subscriptions_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/subscriptions/'; 436 431 … … 442 437 443 438 // Ugly permalinks 444 $this->set_permalink_structure( '');439 $this->set_permalink_structure(); 445 440 $subscriptions_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&bbp_subs=subscriptions'; 446 441 … … 456 451 457 452 // Pretty permalinks 458 $this->set_permalink_structure( );453 $this->set_permalink_structure( '/%postname%/' ); 459 454 $subscriptions_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/subscriptions/'; 460 455 … … 463 458 464 459 // Ugly permalinks 465 $this->set_permalink_structure( '');460 $this->set_permalink_structure(); 466 461 $subscriptions_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&bbp_subs=subscriptions'; 467 462 … … 565 560 566 561 // Pretty permalinks 567 $this->set_permalink_structure( );562 $this->set_permalink_structure( '/%postname%/' ); 568 563 $topics_created_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/topics/'; 569 564 … … 575 570 576 571 // Ugly permalinks 577 $this->set_permalink_structure( '');572 $this->set_permalink_structure(); 578 573 $topics_created_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&bbp_tops=1'; 579 574 … … 589 584 590 585 // Pretty permalinks 591 $this->set_permalink_structure( );586 $this->set_permalink_structure( '/%postname%/' ); 592 587 $topics_created_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/topics/'; 593 588 … … 596 591 597 592 // Ugly permalinks 598 $this->set_permalink_structure( '');593 $this->set_permalink_structure(); 599 594 $topics_created_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '&bbp_tops=1'; 600 595 … … 609 604 610 605 // Pretty permalinks 611 $this->set_permalink_structure( );606 $this->set_permalink_structure( '/%postname%/' ); 612 607 $replies_created_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/replies/'; 613 608 … … 619 614 620 615 // Ugly permalinks 621 $this->set_permalink_structure( '');616 $this->set_permalink_structure(); 622 617 $replies_created_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user='. $this->keymaster_id . '&bbp_reps=1'; 623 618 … … 633 628 634 629 // Pretty permalinks 635 $this->set_permalink_structure( );630 $this->set_permalink_structure( '/%postname%/' ); 636 631 $replies_created_url = 'http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/replies/'; 637 632 … … 640 635 641 636 // Ugly permalinks 642 $this->set_permalink_structure( '');637 $this->set_permalink_structure(); 643 638 $replies_created_url = 'http://' . WP_TESTS_DOMAIN . '/?bbp_user='. $this->keymaster_id . '&bbp_reps=1'; 644 639 … … 715 710 716 711 // Pretty permalinks 717 $this->set_permalink_structure( );712 $this->set_permalink_structure( '/%postname%/' ); 718 713 $author_link = '<a href="http://' . WP_TESTS_DOMAIN . '/forums/user/' . $this->keymaster_userdata->user_nicename . '/" title="View ' . $display_name . 719 714 ''s profile" class="bbp-author-avatar" rel="nofollow">' . $wp_avatar . … … 731 726 732 727 // Ugly permalinks 733 $this->set_permalink_structure( '');728 $this->set_permalink_structure(); 734 729 $author_link = '<a href="http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '" title="View ' . $display_name . 735 730 ''s profile" class="bbp-author-avatar" rel="nofollow">' . $wp_avatar .
Note: See TracChangeset
for help on using the changeset viewer.