- Timestamp:
- 11/03/2024 06:19:06 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/notifications/test-controller.php
r14026 r14070 33 33 public function test_get_items() { 34 34 $notification_id = $this->bp::factory()->notification->create( array( 'user_id' => $this->user ) ); 35 $this->bp::set_current_user( $this->user );35 wp_set_current_user( $this->user ); 36 36 37 37 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 60 60 $this->bp::factory()->notification->create( array( 'user_id' => $u2 ) ); 61 61 62 $this->bp::set_current_user( $this->user );62 wp_set_current_user( $this->user ); 63 63 64 64 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 89 89 $this->bp::factory()->notification->create( array( 'user_id' => $u2 ) ); 90 90 91 $this->bp::set_current_user( $u3 );91 wp_set_current_user( $u3 ); 92 92 93 93 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 115 115 public function test_get_items_user_cannot_see_notifications_from_others() { 116 116 $u = static::factory()->user->create(); 117 $this->bp::set_current_user( $u );117 wp_set_current_user( $u ); 118 118 119 119 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 128 128 */ 129 129 public function test_get_item() { 130 $this->bp::set_current_user( $this->user );130 wp_set_current_user( $this->user ); 131 131 132 132 $notification = $this->endpoint->get_notification_object( $this->notification_id ); … … 149 149 */ 150 150 public function test_get_embedded_user_from_notification_item() { 151 $this->bp::set_current_user( $this->user );151 wp_set_current_user( $this->user ); 152 152 153 153 $notification_id = $this->bp::factory()->notification->create( array( 'user_id' => $this->user ) ); … … 185 185 ); 186 186 187 $this->bp::set_current_user( $this->user );187 wp_set_current_user( $this->user ); 188 188 189 189 $request = new WP_REST_Request( 'GET', sprintf( $this->endpoint_url . '/%d', $notification_id ) ); … … 219 219 ); 220 220 221 $this->bp::set_current_user( $this->user );221 wp_set_current_user( $this->user ); 222 222 223 223 $request = new WP_REST_Request( 'GET', sprintf( $this->endpoint_url . '/%d', $notification_id ) ); … … 249 249 $blog_title = 'The Foo Bar Blog'; 250 250 251 $this->bp::set_current_user( $this->user );251 wp_set_current_user( $this->user ); 252 252 253 253 $blog_id = self::factory()->blog->create( … … 303 303 $u = static::factory()->user->create(); 304 304 305 $this->bp::set_current_user( $u );305 wp_set_current_user( $u ); 306 306 307 307 $request = new WP_REST_Request( 'GET', sprintf( $this->endpoint_url . '/%d', $notification_id ) ); … … 316 316 */ 317 317 public function test_create_item() { 318 $this->bp::set_current_user( $this->user );318 wp_set_current_user( $this->user ); 319 319 320 320 $request = new WP_REST_Request( 'POST', $this->endpoint_url ); … … 333 333 */ 334 334 public function test_rest_create_item() { 335 $this->bp::set_current_user( $this->user );335 wp_set_current_user( $this->user ); 336 336 337 337 $request = new WP_REST_Request( 'POST', $this->endpoint_url ); … … 366 366 public function test_create_item_user_cannot_create() { 367 367 $u = static::factory()->user->create(); 368 $this->bp::set_current_user( $u );368 wp_set_current_user( $u ); 369 369 370 370 $request = new WP_REST_Request( 'POST', $this->endpoint_url ); … … 385 385 $notification_id = $this->bp::factory()->notification->create( $this->set_notification_data() ); 386 386 387 $this->bp::set_current_user( $this->user );387 wp_set_current_user( $this->user ); 388 388 389 389 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $notification_id ) ); … … 409 409 */ 410 410 public function test_update_item_invalid_id() { 411 $this->bp::set_current_user( $this->user );411 wp_set_current_user( $this->user ); 412 412 413 413 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ) ); … … 440 440 441 441 $u = static::factory()->user->create(); 442 $this->bp::set_current_user( $u );442 wp_set_current_user( $u ); 443 443 444 444 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $notification_id ) ); … … 455 455 $notification_id = $this->bp::factory()->notification->create( $this->set_notification_data() ); 456 456 457 $this->bp::set_current_user( $this->user );457 wp_set_current_user( $this->user ); 458 458 459 459 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $notification_id ) ); … … 476 476 477 477 $this->assertEquals( $notification_id, $notification->id ); 478 $this->bp::set_current_user( $this->user );478 wp_set_current_user( $this->user ); 479 479 480 480 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', $notification_id ) ); … … 495 495 */ 496 496 public function test_delete_item_invalid_id() { 497 $this->bp::set_current_user( $this->user );497 wp_set_current_user( $this->user ); 498 498 499 499 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ) ); … … 522 522 523 523 $u = static::factory()->user->create(); 524 $this->bp::set_current_user( $u );524 wp_set_current_user( $u ); 525 525 526 526 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', $notification_id ) ); … … 535 535 */ 536 536 public function test_prepare_item() { 537 $this->bp::set_current_user( $this->user );537 wp_set_current_user( $this->user ); 538 538 539 539 $notification = $this->endpoint->get_notification_object( $this->notification_id ); … … 672 672 ); 673 673 674 $this->bp::set_current_user( $this->user );674 wp_set_current_user( $this->user ); 675 675 $expected = 'bar_value'; 676 676 … … 719 719 720 720 $notification_id = $this->bp::factory()->notification->create( $this->set_notification_data() ); 721 $this->bp::set_current_user( $this->user );721 wp_set_current_user( $this->user ); 722 722 $expected = 'foo_value'; 723 723
Note: See TracChangeset
for help on using the changeset viewer.