Changeset 9194 for trunk/tests/phpunit/testcases/blogs/functions.php
- Timestamp:
- 11/27/2014 05:13:29 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/blogs/functions.php
r9139 r9194 299 299 300 300 $this->assertTrue( $this->activity_exists_for_post( $post_id ), 'Published post should have activity (no change)' ); 301 } 302 303 /** 304 * @group bp_blogs_catch_transition_post_status 305 */ 306 public function test_transition_post_status_password_publish() { 307 $post_id = $this->factory->post->create( array( 308 'post_status' => 'publish', 309 'post_type' => 'post', 310 'post_password' => 'pass', 311 ) ); 312 $post = get_post( $post_id ); 313 314 // 'new' => 'publish with password' 315 $this->assertFalse( $this->activity_exists_for_post( $post_id ), 'Published with password post should not have activity' ); 316 } 317 318 /** 319 * @group bp_blogs_catch_transition_post_status 320 */ 321 public function test_transition_post_status_publish_update_password() { 322 $post_id = $this->factory->post->create( array( 323 'post_status' => 'publish', 324 'post_type' => 'post', 325 ) ); 326 $post = get_post( $post_id ); 327 328 // 'publish' => 'publish' 329 $this->assertTrue( $this->activity_exists_for_post( $post_id ), 'Published post should have activity' ); 330 331 $post->post_content .= ' foo'; 332 $post->post_password = 'pass'; 333 334 wp_update_post( $post ); 335 336 $this->assertFalse( $this->activity_exists_for_post( $post_id ), 'Updated with password post should not have activity' ); 337 } 338 339 /** 340 * @group bp_blogs_catch_transition_post_status 341 */ 342 public function test_transition_post_status_private_publish() { 343 $post_id = $this->factory->post->create( array( 344 'post_status' => 'private', 345 'post_type' => 'post', 346 ) ); 347 $post = get_post( $post_id ); 348 349 // 'new' => 'private' 350 $this->assertFalse( $this->activity_exists_for_post( $post_id ), 'Private post should not have activity' ); 351 352 $post->post_status = 'publish'; 353 354 wp_update_post( $post ); 355 356 // 'private' => 'publish' 357 $this->assertTrue( $this->activity_exists_for_post( $post_id ), 'Published post should have activity' ); 358 } 359 360 /** 361 * @group bp_blogs_catch_transition_post_status 362 */ 363 public function test_transition_post_status_publish_private() { 364 $post_id = $this->factory->post->create( array( 365 'post_status' => 'publish', 366 'post_type' => 'post', 367 ) ); 368 $post = get_post( $post_id ); 369 370 // 'new' => 'publish' 371 $this->assertTrue( $this->activity_exists_for_post( $post_id ), 'Published post should have activity' ); 372 373 $post->post_status = 'private'; 374 375 wp_update_post( $post ); 376 377 // 'publish' => 'private' 378 $this->assertFalse( $this->activity_exists_for_post( $post_id ), 'Private post should not have activity' ); 301 379 } 302 380 … … 478 556 } 479 557 558 /** 559 * @group bp_blogs_catch_transition_post_status 560 */ 561 public function test_bp_blogs_is_blog_trackable_false_publish_post() { 562 add_filter( 'bp_blogs_is_blog_trackable', '__return_false' ); 563 564 $post_id = $this->factory->post->create( array( 565 'post_status' => 'publish', 566 'post_type' => 'post', 567 ) ); 568 $post = get_post( $post_id ); 569 570 // 'new' => 'publish' 571 $this->assertFalse( $this->activity_exists_for_post( $post_id ), 'Not trackable blog post should not have activity' ); 572 573 $post->post_content .= ' foo'; 574 575 wp_update_post( $post ); 576 577 // 'publish' => 'publish' 578 $this->assertFalse( $this->activity_exists_for_post( $post_id ), 'Not trackable blog post should not have activity' ); 579 580 remove_filter( 'bp_blogs_is_blog_trackable', '__return_false' ); 581 } 582 583 /** 584 * @group bp_blogs_catch_transition_post_status 585 */ 586 public function test_bp_is_blog_public_zero_publish_post() { 587 if ( ! is_multisite() ) { 588 return; 589 } 590 591 add_filter( 'bp_is_blog_public', '__return_zero' ); 592 593 $post_id = $this->factory->post->create( array( 594 'post_status' => 'publish', 595 'post_type' => 'post', 596 ) ); 597 $post = get_post( $post_id ); 598 599 // 'new' => 'publish' 600 $this->assertFalse( $this->activity_exists_for_post( $post_id ), 'Not public blog post should not have activity' ); 601 602 $post->post_content .= ' foo'; 603 604 wp_update_post( $post ); 605 606 // 'publish' => 'publish' 607 $this->assertFalse( $this->activity_exists_for_post( $post_id ), 'Not public blog post should not have activity' ); 608 609 remove_filter( 'bp_is_blog_public', '__return_zero' ); 610 } 611 480 612 protected function activity_exists_for_post( $post_id ) { 481 613 $a = bp_activity_get( array(
Note: See TracChangeset
for help on using the changeset viewer.