- Timestamp:
- 11/03/2024 06:19:06 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/groups/test-controller.php
r14026 r14070 38 38 */ 39 39 public function test_get_items() { 40 $this->bp::set_current_user( $this->user );40 wp_set_current_user( $this->user ); 41 41 42 42 $this->bp::factory()->group->create_many( 3 ); … … 81 81 $this->bp::add_user_to_group( $u, $g2 ); 82 82 83 $this->bp::set_current_user( $u );83 wp_set_current_user( $u ); 84 84 85 85 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 124 124 $this->bp::add_user_to_group( $u, $g2 ); 125 125 126 $this->bp::set_current_user( $u );126 wp_set_current_user( $u ); 127 127 128 128 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 160 160 161 161 $this->bp::add_user_to_group( $u, $g ); 162 $this->bp::set_current_user( $u );162 wp_set_current_user( $u ); 163 163 164 164 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 201 201 $this->bp::add_user_to_group( $u, $g6 ); 202 202 203 $this->bp::set_current_user( $u );203 wp_set_current_user( $u ); 204 204 205 205 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 271 271 */ 272 272 public function test_get_items_edit_context_users_private_data() { 273 $this->bp::set_current_user( $this->user );273 wp_set_current_user( $this->user ); 274 274 275 275 $this->bp::factory()->group->create(); … … 302 302 $u2 = $this->bp::factory()->user->create(); 303 303 304 $this->bp::set_current_user( $u1 );304 wp_set_current_user( $u1 ); 305 305 306 306 $now = time(); … … 347 347 */ 348 348 public function test_get_items_with_group_types() { 349 $this->bp::set_current_user( $this->user );349 wp_set_current_user( $this->user ); 350 350 351 351 bp_groups_register_group_type( 'foo' ); … … 383 383 public function test_get_item() { 384 384 $u = static::factory()->user->create(); 385 $this->bp::set_current_user( $u );385 wp_set_current_user( $u ); 386 386 387 387 $group = $this->endpoint->get_group_object( $this->group_id ); … … 434 434 */ 435 435 public function test_get_item_invalid_group_id() { 436 $this->bp::set_current_user( $this->user );436 wp_set_current_user( $this->user ); 437 437 438 438 $request = new WP_REST_Request( 'GET', sprintf( $this->endpoint_url . '/%d', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ) ); … … 456 456 457 457 $this->bp::add_user_to_group( $u, $group->id ); 458 $this->bp::set_current_user( $u );458 wp_set_current_user( $u ); 459 459 460 460 $request = new WP_REST_Request( 'GET', sprintf( $this->endpoint_url . '/%d', $group->id ) ); … … 482 482 $group = $this->endpoint->get_group_object( $g ); 483 483 484 $this->bp::set_current_user( $u );484 wp_set_current_user( $u ); 485 485 486 486 $request = new WP_REST_Request( 'GET', sprintf( $this->endpoint_url . '/%d', $group->id ) ); … … 497 497 public function test_get_item_with_avatar() { 498 498 $u = static::factory()->user->create(); 499 $this->bp::set_current_user( $u );499 wp_set_current_user( $u ); 500 500 501 501 $group = $this->endpoint->get_group_object( $this->group_id ); … … 517 517 public function test_get_item_without_avatar() { 518 518 $u = static::factory()->user->create(); 519 $this->bp::set_current_user( $u );519 wp_set_current_user( $u ); 520 520 521 521 $group = $this->endpoint->get_group_object( $this->group_id ); … … 539 539 public function test_get_item_extra() { 540 540 $u = static::factory()->user->create(); 541 $this->bp::set_current_user( $u );541 wp_set_current_user( $u ); 542 542 543 543 $group = $this->endpoint->get_group_object( $this->group_id ); … … 561 561 */ 562 562 public function test_render_item() { 563 $this->bp::set_current_user( $this->user );563 wp_set_current_user( $this->user ); 564 564 565 565 $g = $this->bp::factory()->group->create( … … 583 583 */ 584 584 public function test_create_item() { 585 $this->bp::set_current_user( $this->user );585 wp_set_current_user( $this->user ); 586 586 587 587 $request = new WP_REST_Request( 'POST', $this->endpoint_url ); … … 600 600 */ 601 601 public function test_rest_create_item() { 602 $this->bp::set_current_user( $this->user );602 wp_set_current_user( $this->user ); 603 603 604 604 $request = new WP_REST_Request( 'POST', $this->endpoint_url ); … … 619 619 bp_groups_register_group_type( 'foo' ); 620 620 621 $this->bp::set_current_user( $this->user );621 wp_set_current_user( $this->user ); 622 622 623 623 $request = new WP_REST_Request( 'POST', $this->endpoint_url ); … … 636 636 */ 637 637 public function test_create_item_with_no_name() { 638 $this->bp::set_current_user( $this->user );638 wp_set_current_user( $this->user ); 639 639 640 640 $request = new WP_REST_Request( 'POST', $this->endpoint_url ); … … 686 686 $this->assertEquals( $this->group_id, $group->id ); 687 687 688 $this->bp::set_current_user( $this->user );688 wp_set_current_user( $this->user ); 689 689 690 690 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $group->id ) ); … … 714 714 bp_groups_set_group_type( $this->group_id, 'bar' ); 715 715 716 $this->bp::set_current_user( $this->user );716 wp_set_current_user( $this->user ); 717 717 718 718 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 735 735 bp_groups_set_group_type( $this->group_id, 'bar' ); 736 736 737 $this->bp::set_current_user( $this->user );737 wp_set_current_user( $this->user ); 738 738 739 739 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 757 757 bp_groups_set_group_type( $this->group_id, 'bar' ); 758 758 759 $this->bp::set_current_user( $this->user );759 wp_set_current_user( $this->user ); 760 760 761 761 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 774 774 */ 775 775 public function test_update_item_invalid_id() { 776 $this->bp::set_current_user( $this->user );776 wp_set_current_user( $this->user ); 777 777 778 778 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ) ); … … 804 804 805 805 $u2 = static::factory()->user->create(); 806 $this->bp::set_current_user( $u2 );806 wp_set_current_user( $u2 ); 807 807 808 808 $group = $this->endpoint->get_group_object( $a ); … … 823 823 */ 824 824 public function test_site_admins_can_update_item() { 825 $this->bp::set_current_user( $this->user );825 wp_set_current_user( $this->user ); 826 826 827 827 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 851 851 $this->bp::add_user_to_group( $u, $this->group_id, array( 'is_admin' => true ) ); 852 852 853 $this->bp::set_current_user( $u );853 wp_set_current_user( $u ); 854 854 855 855 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 879 879 $this->bp::add_user_to_group( $u, $this->group_id, array( 'is_mod' => true ) ); 880 880 881 $this->bp::set_current_user( $u );881 wp_set_current_user( $u ); 882 882 883 883 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 897 897 public function test_update_item_invalid_status() { 898 898 $group = $this->endpoint->get_group_object( $this->group_id ); 899 $this->bp::set_current_user( $this->user );899 wp_set_current_user( $this->user ); 900 900 901 901 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $group->id ) ); … … 914 914 */ 915 915 public function test_delete_item() { 916 $this->bp::set_current_user( $this->user );916 wp_set_current_user( $this->user ); 917 917 918 918 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 930 930 */ 931 931 public function test_delete_item_invalid_id() { 932 $this->bp::set_current_user( $this->user );932 wp_set_current_user( $this->user ); 933 933 934 934 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ) ); … … 952 952 */ 953 953 public function test_delete_item_without_permission() { 954 $this->bp::set_current_user( static::factory()->user->create() );954 wp_set_current_user( static::factory()->user->create() ); 955 955 956 956 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 969 969 $this->bp::add_user_to_group( $u, $this->group_id, array( 'is_mod' => true ) ); 970 970 971 $this->bp::set_current_user( $u );971 wp_set_current_user( $u ); 972 972 973 973 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 981 981 */ 982 982 public function test_site_admins_can_delete_group() { 983 $this->bp::set_current_user( $this->user );983 wp_set_current_user( $this->user ); 984 984 985 985 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 1002 1002 $this->bp::add_user_to_group( $u, $this->group_id, array( 'is_admin' => true ) ); 1003 1003 1004 $this->bp::set_current_user( $u );1004 wp_set_current_user( $u ); 1005 1005 1006 1006 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', $this->group_id ) ); … … 1019 1019 public function test_get_current_user_groups() { 1020 1020 $u = static::factory()->user->create(); 1021 $this->bp::set_current_user( $u );1021 wp_set_current_user( $u ); 1022 1022 1023 1023 $groups = array(); … … 1046 1046 public function test_get_current_user_groups_max_one() { 1047 1047 $u = static::factory()->user->create(); 1048 $this->bp::set_current_user( $u );1048 wp_set_current_user( $u ); 1049 1049 1050 1050 $groups = array(); … … 1084 1084 1085 1085 public function test_prepare_item() { 1086 $this->bp::set_current_user( $this->user );1086 wp_set_current_user( $this->user ); 1087 1087 1088 1088 $group = $this->endpoint->get_group_object( $this->group_id ); … … 1261 1261 ); 1262 1262 1263 $this->bp::set_current_user( $this->user );1263 wp_set_current_user( $this->user ); 1264 1264 $expected = 'bar_value'; 1265 1265 … … 1307 1307 ); 1308 1308 1309 $this->bp::set_current_user( $this->user );1309 wp_set_current_user( $this->user ); 1310 1310 1311 1311 $expected = 'foo_value';
Note: See TracChangeset
for help on using the changeset viewer.