Changeset 12163 for trunk/tests/phpunit/testcases/groups/functions.php
- Timestamp:
- 06/04/2018 08:52:12 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/groups/functions.php
r11737 r12163 6 6 */ 7 7 class BP_Tests_Groups_Functions extends BP_UnitTestCase { 8 static public $group_ids; 9 static public $user_ids; 10 11 static public function wpSetUpBeforeClass( $factory ) { 12 self::$user_ids = $factory->user->create_many( 3 ); 13 self::$group_ids = $factory->group->create_many( 2, array( 14 'creator_id' => self::$user_ids[2], 15 ) ); 16 } 17 18 static public function wpTearDownAfterClass() { 19 array_map( array( __CLASS__, 'delete_user' ), self::$user_ids ); 20 array_map( 'groups_delete_group', self::$group_ids ); 21 } 22 8 23 public function test_creating_new_group_as_authenticated_user() { 9 24 $u = self::factory()->user->create(); … … 850 865 } 851 866 867 /** 868 * @ticket BP7820 869 * @ticket BP7698 870 */ 871 public function test_bp_groups_memberships_personal_data_exporter() { 872 groups_join_group( self::$group_ids[0], self::$user_ids[0] ); 873 874 $test_user = new WP_User( self::$user_ids[0] ); 875 876 $actual = bp_groups_memberships_personal_data_exporter( $test_user->user_email, 1 ); 877 878 $this->assertTrue( $actual['done'] ); 879 $this->assertCount( 1, $actual['data'] ); 880 $this->assertSame( 'bp-group-membership-' . self::$group_ids[0], $actual['data'][0]['item_id'] ); 881 } 882 883 /** 884 * @ticket BP7820 885 * @ticket BP7698 886 */ 887 public function test_bp_groups_pending_requests_personal_data_exporter() { 888 groups_send_membership_request( self::$user_ids[0], self::$group_ids[0] ); 889 890 $test_user = new WP_User( self::$user_ids[0] ); 891 892 $actual = bp_groups_pending_requests_personal_data_exporter( $test_user->user_email, 1 ); 893 894 $this->assertTrue( $actual['done'] ); 895 $this->assertCount( 1, $actual['data'] ); 896 $this->assertSame( 'bp-group-pending-request-' . self::$group_ids[0], $actual['data'][0]['item_id'] ); 897 } 898 899 /** 900 * @ticket BP7820 901 * @ticket BP7698 902 */ 903 public function test_bp_groups_pending_sent_invitations_personal_data_exporter() { 904 groups_invite_user( array( 905 'user_id' => self::$user_ids[1], 906 'group_id' => self::$group_ids[0], 907 'inviter_id' => self::$user_ids[0], 908 ) ); 909 910 $test_user = new WP_User( self::$user_ids[0] ); 911 912 $actual = bp_groups_pending_sent_invitations_personal_data_exporter( $test_user->user_email, 1 ); 913 914 $this->assertTrue( $actual['done'] ); 915 $this->assertCount( 1, $actual['data'] ); 916 $this->assertSame( 'bp-group-pending-sent-invitation-' . self::$group_ids[0], $actual['data'][0]['item_id'] ); 917 } 918 919 /** 920 * @ticket BP7820 921 * @ticket BP7698 922 */ 923 public function test_bp_groups_pending_received_invitations_personal_data_exporter() { 924 groups_invite_user( array( 925 'user_id' => self::$user_ids[0], 926 'group_id' => self::$group_ids[0], 927 'inviter_id' => self::$user_ids[1], 928 ) ); 929 930 $test_user = new WP_User( self::$user_ids[0] ); 931 932 $actual = bp_groups_pending_received_invitations_personal_data_exporter( $test_user->user_email, 1 ); 933 934 $this->assertTrue( $actual['done'] ); 935 $this->assertCount( 1, $actual['data'] ); 936 $this->assertSame( 'bp-group-pending-received-invitation-' . self::$group_ids[0], $actual['data'][0]['item_id'] ); 937 } 852 938 }
Note: See TracChangeset
for help on using the changeset viewer.