- Timestamp:
- 11/03/2024 06:19:06 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/messages/test-sidewide-notices-controller.php
r14026 r14070 100 100 */ 101 101 public function test_get_items() { 102 $this->bp::set_current_user( $this->user );102 wp_set_current_user( $this->user ); 103 103 104 104 $tested = array( … … 135 135 */ 136 136 public function test_get_items_no_edit_access() { 137 $this->bp::set_current_user( $this->user );137 wp_set_current_user( $this->user ); 138 138 $tested = array( 139 139 'n1' => array( … … 148 148 149 149 $u1 = static::factory()->user->create(); 150 $this->bp::set_current_user( $u1 );150 wp_set_current_user( $u1 ); 151 151 152 152 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 161 161 */ 162 162 public function test_get_items_view_active() { 163 $this->bp::set_current_user( $this->user );163 wp_set_current_user( $this->user ); 164 164 $tested = array( 165 165 'n1' => array( … … 177 177 178 178 $u1 = static::factory()->user->create(); 179 $this->bp::set_current_user( $u1 );179 wp_set_current_user( $u1 ); 180 180 181 181 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 198 198 */ 199 199 public function test_get_items_no_active() { 200 $this->bp::set_current_user( $this->user );201 202 $u1 = static::factory()->user->create(); 203 $this->bp::set_current_user( $u1 );200 wp_set_current_user( $this->user ); 201 202 $u1 = static::factory()->user->create(); 203 wp_set_current_user( $u1 ); 204 204 205 205 $request = new WP_REST_Request( 'GET', $this->endpoint_url ); … … 215 215 */ 216 216 public function test_get_item() { 217 $this->bp::set_current_user( $this->user );217 wp_set_current_user( $this->user ); 218 218 $tested = array( 219 219 'n1' => array( … … 233 233 234 234 $u1 = static::factory()->user->create(); 235 $this->bp::set_current_user( $u1 );235 wp_set_current_user( $u1 ); 236 236 237 237 $request = new WP_REST_Request( 'GET', $this->endpoint_url . '/' . $id ); … … 251 251 */ 252 252 public function test_get_item_admin_access() { 253 $this->bp::set_current_user( $this->user );253 wp_set_current_user( $this->user ); 254 254 $tested = array( 255 255 'n1' => array( … … 284 284 */ 285 285 public function test_get_item_no_access() { 286 $this->bp::set_current_user( $this->user );286 wp_set_current_user( $this->user ); 287 287 $tested = array( 288 288 'n1' => array( … … 301 301 302 302 $u1 = static::factory()->user->create(); 303 $this->bp::set_current_user( $u1 );303 wp_set_current_user( $u1 ); 304 304 305 305 $request = new WP_REST_Request( 'GET', $this->endpoint_url . '/' . $id ); … … 314 314 */ 315 315 public function test_get_item_view_active() { 316 $this->bp::set_current_user( $this->user );316 wp_set_current_user( $this->user ); 317 317 $tested = array( 318 318 'n1' => array( … … 332 332 333 333 $u1 = static::factory()->user->create(); 334 $this->bp::set_current_user( $u1 );334 wp_set_current_user( $u1 ); 335 335 336 336 $request = new WP_REST_Request( 'GET', $this->endpoint_url . '/' . $id ); … … 350 350 */ 351 351 public function test_get_item_with_invalid_id() { 352 $this->bp::set_current_user( $this->user );352 wp_set_current_user( $this->user ); 353 353 354 354 $request = new WP_REST_Request( 'GET', $this->endpoint_url . '/' . REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ); … … 363 363 */ 364 364 public function test_create_item() { 365 $this->bp::set_current_user( $this->user );365 wp_set_current_user( $this->user ); 366 366 367 367 $request = new WP_REST_Request( 'POST', $this->endpoint_url ); … … 388 388 */ 389 389 public function test_create_item_no_access() { 390 $this->bp::set_current_user( static::factory()->user->create() );390 wp_set_current_user( static::factory()->user->create() ); 391 391 392 392 $request = new WP_REST_Request( 'POST', $this->endpoint_url ); … … 408 408 */ 409 409 public function test_create_item_no_subject() { 410 $this->bp::set_current_user( $this->user );410 wp_set_current_user( $this->user ); 411 411 412 412 $request = new WP_REST_Request( 'POST', $this->endpoint_url ); … … 428 428 */ 429 429 public function test_update_item() { 430 $this->bp::set_current_user( $this->user );430 wp_set_current_user( $this->user ); 431 431 $tested = array( 432 432 'n1' => array( … … 458 458 */ 459 459 public function test_update_item_no_access() { 460 $this->bp::set_current_user( $this->user );460 wp_set_current_user( $this->user ); 461 461 $tested = array( 462 462 'n1' => array( … … 469 469 470 470 $u1 = static::factory()->user->create(); 471 $this->bp::set_current_user( $u1 );471 wp_set_current_user( $u1 ); 472 472 473 473 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', $n->id ) ); … … 483 483 */ 484 484 public function test_update_item_no_message() { 485 $this->bp::set_current_user( $this->user );485 wp_set_current_user( $this->user ); 486 486 $tested = array( 487 487 'n1' => array( … … 505 505 */ 506 506 public function test_update_item_with_invalid_id() { 507 $this->bp::set_current_user( $this->user );507 wp_set_current_user( $this->user ); 508 508 509 509 $request = new WP_REST_Request( 'PUT', sprintf( $this->endpoint_url . '/%d', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ) ); … … 519 519 */ 520 520 public function test_delete_item() { 521 $this->bp::set_current_user( $this->user );521 wp_set_current_user( $this->user ); 522 522 $tested = array( 523 523 'n1' => array( … … 546 546 */ 547 547 public function test_delete_item_no_access() { 548 $this->bp::set_current_user( $this->user );548 wp_set_current_user( $this->user ); 549 549 $tested = array( 550 550 'n1' => array( … … 557 557 558 558 $u1 = static::factory()->user->create(); 559 $this->bp::set_current_user( $u1 );559 wp_set_current_user( $u1 ); 560 560 561 561 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', $n->id ) ); … … 570 570 */ 571 571 public function test_delete_item_with_invalid_id() { 572 $this->bp::set_current_user( $this->user );572 wp_set_current_user( $this->user ); 573 573 574 574 $request = new WP_REST_Request( 'DELETE', sprintf( $this->endpoint_url . '/%d', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER ) ); … … 583 583 */ 584 584 public function test_dismiss_item() { 585 $this->bp::set_current_user( $this->user );585 wp_set_current_user( $this->user ); 586 586 $tested = array( 587 587 'n1' => array( … … 594 594 595 595 $u1 = static::factory()->user->create(); 596 $this->bp::set_current_user( $u1 );596 wp_set_current_user( $u1 ); 597 597 598 598 $request = new WP_REST_Request( 'PUT', $this->endpoint_url . '/dismiss' ); … … 614 614 */ 615 615 public function test_dismiss_item_no_actives() { 616 $this->bp::set_current_user( $this->user );616 wp_set_current_user( $this->user ); 617 617 $tested = array( 618 618 'n1' => array( … … 625 625 626 626 $u1 = static::factory()->user->create(); 627 $this->bp::set_current_user( $u1 );627 wp_set_current_user( $u1 ); 628 628 629 629 $request = new WP_REST_Request( 'PUT', $this->endpoint_url . '/dismiss' ); … … 638 638 */ 639 639 public function test_dismiss_item_not_logged_in() { 640 $this->bp::set_current_user( $this->user );640 wp_set_current_user( $this->user ); 641 641 $tested = array( 642 642 'n1' => array( … … 647 647 $this->create_notice( $tested ); 648 648 649 $this->bp::set_current_user( 0 );649 wp_set_current_user( 0 ); 650 650 651 651 $request = new WP_REST_Request( 'PUT', $this->endpoint_url . '/dismiss' );
Note: See TracChangeset
for help on using the changeset viewer.