diff --git tests/phpunit/testcases/activity/actions.php tests/phpunit/testcases/activity/actions.php
index 799a8fe..c21a5f7 100644
|
|
|
class BP_Tests_Activity_Actions extends BP_UnitTestCase { |
| 23 | 23 | */ |
| 24 | 24 | public function test_bp_activity_catch_transition_post_type_status_publish() { |
| 25 | 25 | $bp = buddypress(); |
| | 26 | $activity_actions = $bp->activity->actions; |
| | 27 | $bp->activity->actions = new stdClass(); |
| 26 | 28 | |
| 27 | 29 | register_post_type( 'foo', array( |
| 28 | 30 | 'label' => 'foo', |
| … |
… |
class BP_Tests_Activity_Actions extends BP_UnitTestCase { |
| 43 | 45 | _unregister_post_type( 'foo' ); |
| 44 | 46 | |
| 45 | 47 | // Reset globals |
| 46 | | unset( $bp->activity->actions->activity->new_foo ); |
| | 48 | $bp->activity->actions = $activity_actions; |
| 47 | 49 | $bp->activity->track = array(); |
| 48 | 50 | } |
| 49 | 51 | |
| … |
… |
class BP_Tests_Activity_Actions extends BP_UnitTestCase { |
| 53 | 55 | */ |
| 54 | 56 | public function test_bp_activity_catch_transition_post_type_status_publish_to_publish() { |
| 55 | 57 | $bp = buddypress(); |
| | 58 | $activity_actions = $bp->activity->actions; |
| | 59 | $bp->activity->actions = new stdClass(); |
| 56 | 60 | |
| 57 | 61 | register_post_type( 'foo', array( |
| 58 | 62 | 'label' => 'foo', |
| … |
… |
class BP_Tests_Activity_Actions extends BP_UnitTestCase { |
| 83 | 87 | _unregister_post_type( 'foo' ); |
| 84 | 88 | |
| 85 | 89 | // Reset globals |
| 86 | | unset( $bp->activity->actions->activity->new_foo ); |
| | 90 | $bp->activity->actions = $activity_actions; |
| 87 | 91 | $bp->activity->track = array(); |
| 88 | 92 | } |
| 89 | 93 | |
| … |
… |
class BP_Tests_Activity_Actions extends BP_UnitTestCase { |
| 93 | 97 | */ |
| 94 | 98 | public function test_bp_activity_catch_transition_post_type_status_publish_password() { |
| 95 | 99 | $bp = buddypress(); |
| | 100 | $activity_actions = $bp->activity->actions; |
| | 101 | $bp->activity->actions = new stdClass(); |
| 96 | 102 | |
| 97 | 103 | register_post_type( 'foo', array( |
| 98 | 104 | 'label' => 'foo', |
| … |
… |
class BP_Tests_Activity_Actions extends BP_UnitTestCase { |
| 121 | 127 | _unregister_post_type( 'foo' ); |
| 122 | 128 | |
| 123 | 129 | // Reset globals |
| 124 | | unset( $bp->activity->actions->activity->new_foo ); |
| | 130 | $bp->activity->actions = $activity_actions; |
| 125 | 131 | $bp->activity->track = array(); |
| 126 | 132 | } |
| 127 | 133 | |
| … |
… |
class BP_Tests_Activity_Actions extends BP_UnitTestCase { |
| 131 | 137 | */ |
| 132 | 138 | public function test_bp_activity_catch_transition_post_type_status_publish_trash() { |
| 133 | 139 | $bp = buddypress(); |
| | 140 | $activity_actions = $bp->activity->actions; |
| | 141 | $bp->activity->actions = new stdClass(); |
| 134 | 142 | |
| 135 | 143 | register_post_type( 'foo', array( |
| 136 | 144 | 'label' => 'foo', |
| … |
… |
class BP_Tests_Activity_Actions extends BP_UnitTestCase { |
| 156 | 164 | _unregister_post_type( 'foo' ); |
| 157 | 165 | |
| 158 | 166 | // Reset globals |
| 159 | | unset( $bp->activity->actions->activity->new_foo ); |
| | 167 | $bp->activity->actions = $activity_actions; |
| 160 | 168 | $bp->activity->track = array(); |
| 161 | 169 | } |
| 162 | 170 | |
diff --git tests/phpunit/testcases/activity/functions.php tests/phpunit/testcases/activity/functions.php
index 4f8cad6..2b32c7f 100644
|
|
|
Bar!'; |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | $bp = buddypress(); |
| | 589 | $activity_actions = $bp->activity->actions; |
| | 590 | $bp->activity->actions = new stdClass(); |
| 589 | 591 | |
| 590 | 592 | register_post_type( 'foo', array( |
| 591 | 593 | 'label' => 'foo', |
| … |
… |
Bar!'; |
| 624 | 626 | _unregister_post_type( 'foo' ); |
| 625 | 627 | |
| 626 | 628 | // Reset globals |
| 627 | | unset( $bp->activity->actions->activity->new_foo ); |
| | 629 | $bp->activity->actions = $activity_actions; |
| 628 | 630 | $bp->activity->track = array(); |
| 629 | 631 | } |
| 630 | 632 | |
| … |
… |
Bar!'; |
| 639 | 641 | } |
| 640 | 642 | |
| 641 | 643 | $bp = buddypress(); |
| | 644 | $activity_actions = $bp->activity->actions; |
| | 645 | $bp->activity->actions = new stdClass(); |
| 642 | 646 | |
| 643 | 647 | $b = $this->factory->blog->create(); |
| 644 | 648 | $u = $this->factory->user->create(); |
| … |
… |
Bar!'; |
| 687 | 691 | $this->assertSame( $expected, $a_obj->action ); |
| 688 | 692 | |
| 689 | 693 | // Reset globals |
| 690 | | unset( $bp->activity->actions->activity->new_foo ); |
| | 694 | $bp->activity->actions = $activity_actions; |
| 691 | 695 | $bp->activity->track = array(); |
| 692 | 696 | } |
| 693 | 697 | |
| … |
… |
Bar!'; |
| 696 | 700 | * @group bp_activity_get_actions |
| 697 | 701 | */ |
| 698 | 702 | public function test_bp_activity_get_actions_should_sort_by_position() { |
| 699 | | $old_actions = bp_activity_get_actions(); |
| 700 | | buddypress()->activity->actions = new stdClass; |
| | 703 | $bp = buddypress(); |
| | 704 | $old_actions = $bp->activity->actions; |
| | 705 | $bp->activity->actions = new stdClass; |
| 701 | 706 | |
| 702 | 707 | register_post_type( 'foo5', array( |
| 703 | 708 | 'public' => true, |
| … |
… |
Bar!'; |
| 739 | 744 | $foo_actions = (array) $actions->foo; |
| 740 | 745 | $this->assertEquals( $expected, array_values( wp_list_pluck( $foo_actions, 'key' ) ) ); |
| 741 | 746 | |
| 742 | | buddypress()->activity->actions = $old_actions; |
| | 747 | $bp->activity->actions = $old_actions; |
| 743 | 748 | } |
| 744 | 749 | |
| 745 | 750 | /** |
| … |
… |
Bar!'; |
| 752 | 757 | } |
| 753 | 758 | |
| 754 | 759 | $bp = buddypress(); |
| | 760 | $activity_actions = $bp->activity->actions; |
| | 761 | $bp->activity->actions = new stdClass(); |
| 755 | 762 | |
| 756 | 763 | $labels = array( |
| 757 | 764 | 'name' => 'bars', |
| … |
… |
Bar!'; |
| 798 | 805 | _unregister_post_type( 'foo' ); |
| 799 | 806 | |
| 800 | 807 | // Reset globals |
| 801 | | unset( $bp->activity->actions->activity->foo_bar ); |
| | 808 | $bp->activity->actions = $activity_actions; |
| 802 | 809 | $bp->activity->track = array(); |
| 803 | 810 | } |
| 804 | 811 | |
| … |
… |
Bar!'; |
| 814 | 821 | |
| 815 | 822 | $bp = buddypress(); |
| 816 | 823 | $reset = $bp->activity->actions; |
| | 824 | $bp->activity->actions = new stdClass(); |
| 817 | 825 | |
| 818 | 826 | $b = $this->factory->blog->create(); |
| 819 | 827 | $u = $this->factory->user->create(); |
| … |
… |
Bar!'; |
| 865 | 873 | $this->assertSame( $expected, $a_obj->action ); |
| 866 | 874 | |
| 867 | 875 | // Reset globals |
| 868 | | unset( $bp->activity->actions->activity->new_foo ); |
| | 876 | $bp->activity->actions = $reset; |
| 869 | 877 | $bp->activity->track = array(); |
| 870 | 878 | } |
| 871 | 879 | |
| … |
… |
Bar!'; |
| 874 | 882 | * @group activity_tracking |
| 875 | 883 | */ |
| 876 | 884 | public function test_bp_activity_set_post_type_tracking_args() { |
| | 885 | global $wp_post_types; |
| | 886 | |
| 877 | 887 | $bp = buddypress(); |
| | 888 | $activity_actions = $bp->activity->actions; |
| | 889 | $bp->activity->actions = new stdClass(); |
| 878 | 890 | |
| 879 | 891 | add_post_type_support( 'page', 'buddypress-activity' ); |
| 880 | 892 | |
| … |
… |
Bar!'; |
| 905 | 917 | remove_post_type_support( 'page', 'buddypress-activity' ); |
| 906 | 918 | |
| 907 | 919 | // Reset globals |
| 908 | | unset( $bp->activity->actions->blogs->new_page ); |
| | 920 | $bp->activity->actions = $activity_actions; |
| | 921 | |
| | 922 | unset( $wp_post_types['page']->bp_activity ); |
| 909 | 923 | $bp->activity->track = array(); |
| 910 | 924 | } |
| 911 | 925 | |
diff --git tests/phpunit/testcases/blogs/activity.php tests/phpunit/testcases/blogs/activity.php
index 96b6ab6..bfb0d2c 100644
|
|
|
class BP_Tests_Blogs_Activity extends BP_UnitTestCase { |
| 7 | 7 | */ |
| 8 | 8 | public function test_bp_blogs_loader_post_tracking_args_filter() { |
| 9 | 9 | $bp = buddypress(); |
| | 10 | $activity_actions = $bp->activity->actions; |
| | 11 | $bp->activity->actions = new stdClass(); |
| | 12 | |
| | 13 | // Make sure regulare actions are populated |
| | 14 | do_action( 'bp_register_activity_actions' ); |
| 10 | 15 | |
| 11 | 16 | $expected = array( 'new_blog_post', 'new_blog_comment' ); |
| 12 | 17 | |
| … |
… |
class BP_Tests_Blogs_Activity extends BP_UnitTestCase { |
| 18 | 23 | $actions = array_keys( (array) $actions->blogs ); |
| 19 | 24 | |
| 20 | 25 | $this->assertEquals( $expected, $actions ); |
| | 26 | |
| | 27 | // Reset globals |
| | 28 | $bp->activity->actions = $activity_actions; |
| 21 | 29 | } |
| 22 | 30 | |
| 23 | 31 | /** |
| … |
… |
class BP_Tests_Blogs_Activity extends BP_UnitTestCase { |
| 54 | 62 | return; |
| 55 | 63 | } |
| 56 | 64 | |
| | 65 | $bp = buddypress(); |
| | 66 | $activity_actions = $bp->activity->actions; |
| | 67 | $bp->activity->actions = new stdClass(); |
| | 68 | |
| 57 | 69 | $u = $this->factory->user->create(); |
| 58 | 70 | $p = $this->factory->post->create( array( |
| 59 | 71 | 'post_author' => $u, |
| … |
… |
class BP_Tests_Blogs_Activity extends BP_UnitTestCase { |
| 77 | 89 | $expected = sprintf( '%s wrote a new post, %s', $user_link, $post_link ); |
| 78 | 90 | |
| 79 | 91 | $this->assertSame( $expected, $a_obj->action ); |
| | 92 | |
| | 93 | // Reset globals |
| | 94 | $bp->activity->actions = $activity_actions; |
| | 95 | $bp->activity->track = array(); |
| 80 | 96 | } |
| 81 | 97 | |
| 82 | 98 | /** |
| … |
… |
class BP_Tests_Blogs_Activity extends BP_UnitTestCase { |
| 88 | 104 | return; |
| 89 | 105 | } |
| 90 | 106 | |
| | 107 | $bp = buddypress(); |
| | 108 | $activity_actions = $bp->activity->actions; |
| | 109 | $bp->activity->actions = new stdClass(); |
| | 110 | |
| 91 | 111 | $u = $this->factory->user->create(); |
| 92 | 112 | $p = $this->factory->post->create( array( |
| 93 | 113 | 'post_author' => $u, |
| … |
… |
class BP_Tests_Blogs_Activity extends BP_UnitTestCase { |
| 111 | 131 | $expected = sprintf( '%s wrote a new post, %s, on the site %s', $user_link, $post_link, '<a href="' . $blog_url . '">' . bp_blogs_get_blogmeta( $a_obj->item_id, 'name' ) . '</a>' ); |
| 112 | 132 | |
| 113 | 133 | $this->assertSame( $expected, $a_obj->action ); |
| | 134 | |
| | 135 | // Reset globals |
| | 136 | $bp->activity->actions = $activity_actions; |
| | 137 | $bp->activity->track = array(); |
| 114 | 138 | } |
| 115 | 139 | |
| 116 | 140 | /** |
| … |
… |
class BP_Tests_Blogs_Activity extends BP_UnitTestCase { |
| 122 | 146 | return; |
| 123 | 147 | } |
| 124 | 148 | |
| | 149 | $bp = buddypress(); |
| | 150 | $activity_actions = $bp->activity->actions; |
| | 151 | $bp->activity->actions = new stdClass(); |
| | 152 | |
| 125 | 153 | $b = $this->factory->blog->create(); |
| 126 | 154 | $u = $this->factory->user->create(); |
| 127 | 155 | |
| … |
… |
class BP_Tests_Blogs_Activity extends BP_UnitTestCase { |
| 151 | 179 | $expected = sprintf( '%s wrote a new post, %s, on the site %s', $user_link, $post_link, '<a href="' . $blog_url . '">' . get_blog_option( $a_obj->item_id, 'blogname' ) . '</a>' ); |
| 152 | 180 | |
| 153 | 181 | $this->assertSame( $expected, $a_obj->action ); |
| | 182 | |
| | 183 | // Reset globals |
| | 184 | $bp->activity->actions = $activity_actions; |
| | 185 | $bp->activity->track = array(); |
| 154 | 186 | } |
| 155 | 187 | |
| 156 | 188 | /** |
| … |
… |
class BP_Tests_Blogs_Activity extends BP_UnitTestCase { |
| 233 | 265 | return; |
| 234 | 266 | } |
| 235 | 267 | |
| | 268 | $bp = buddypress(); |
| | 269 | $activity_actions = $bp->activity->actions; |
| | 270 | $bp->activity->actions = new stdClass(); |
| | 271 | |
| | 272 | // Make sure the filter will be fired |
| | 273 | bp_activity_get_actions(); |
| | 274 | |
| 236 | 275 | add_filter( 'bp_blogs_activity_new_post_action', array( $this, 'new_post_passthrough' ), 10, 2 ); |
| 237 | 276 | |
| 238 | 277 | $b = $this->factory->blog->create(); |
| … |
… |
class BP_Tests_Blogs_Activity extends BP_UnitTestCase { |
| 251 | 290 | ) ); |
| 252 | 291 | |
| 253 | 292 | $this->assertEquals( $this->post_id, $p ); |
| | 293 | |
| | 294 | // Reset globals |
| | 295 | $bp->activity->actions = $activity_actions; |
| | 296 | $bp->activity->track = array(); |
| 254 | 297 | } |
| 255 | 298 | |
| 256 | 299 | /** |