- Timestamp:
- 03/29/2020 05:32:05 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/notifications/functions.php
r12158 r12605 347 347 $this->assertEqualSets( array( $n1, $n2, $n3, $n4, $n5 ), $found1 ); 348 348 349 wp_delete_user( $u );349 $this->delete_user( $u ); 350 350 351 351 // Check if notifications are deleted. … … 464 464 $this->assertSame( 2, count( $actual['data'] ) ); 465 465 } 466 467 /** 468 * @ticket BP8175 469 */ 470 public function test_notifications_data_should_be_deleted_on_user_delete_non_multisite() { 471 if ( is_multisite() ) { 472 $this->markTestSkipped( __METHOD__ . ' requires non-multisite.' ); 473 } 474 475 $u = self::factory()->user->create(); 476 477 $n1 = self::factory()->notification->create( array( 478 'component_name' => 'messages', 479 'component_action' => 'new_message', 480 'item_id' => 99, 481 'user_id' => $u, 482 ) ); 483 484 $found = bp_notifications_get_notifications_for_user( $u, 'object' ); 485 $this->assertEqualSets( [ $n1 ], wp_list_pluck( $found, 'id' ) ); 486 487 wp_delete_user( $u ); 488 489 $found = bp_notifications_get_notifications_for_user( $u, 'object' ); 490 $this->assertEmpty( '', $found ); 491 } 492 493 /** 494 * @ticket BP8175 495 */ 496 public function test_notifications_data_should_be_deleted_on_user_delete_multisite() { 497 if ( ! is_multisite() ) { 498 $this->markTestSkipped( __METHOD__ . ' requires multisite.' ); 499 } 500 501 $u = self::factory()->user->create(); 502 503 $n1 = self::factory()->notification->create( array( 504 'component_name' => 'messages', 505 'component_action' => 'new_message', 506 'item_id' => 99, 507 'user_id' => $u, 508 ) ); 509 510 $found = bp_notifications_get_notifications_for_user( $u, 'object' ); 511 $this->assertEqualSets( [ $n1 ], wp_list_pluck( $found, 'id' ) ); 512 513 wpmu_delete_user( $u ); 514 515 $found = bp_notifications_get_notifications_for_user( $u, 'object' ); 516 $this->assertEmpty( '', $found ); 517 } 518 519 /** 520 * @ticket BP8175 521 */ 522 public function test_notifications_data_should_not_be_deleted_on_wp_delete_user_multisite() { 523 if ( ! is_multisite() ) { 524 $this->markTestSkipped( __METHOD__ . ' requires multisite.' ); 525 } 526 527 $u = self::factory()->user->create(); 528 529 $n1 = self::factory()->notification->create( array( 530 'component_name' => 'messages', 531 'component_action' => 'new_message', 532 'item_id' => 99, 533 'user_id' => $u, 534 ) ); 535 536 $found = bp_notifications_get_notifications_for_user( $u, 'object' ); 537 $this->assertEqualSets( [ $n1 ], wp_list_pluck( $found, 'id' ) ); 538 539 wp_delete_user( $u ); 540 541 $found = bp_notifications_get_notifications_for_user( $u, 'object' ); 542 $this->assertEqualSets( [ $n1 ], wp_list_pluck( $found, 'id' ) ); 543 } 466 544 }
Note: See TracChangeset
for help on using the changeset viewer.