Changeset 13894 for trunk/tests/phpunit/testcases/members/functions.php
- Timestamp:
- 06/02/2024 06:35:51 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/members/functions.php
r13433 r13894 6 6 class BP_Tests_Members_Functions extends BP_UnitTestCase { 7 7 protected $permalink_structure = ''; 8 protected $filter_fired = ''; 8 9 9 10 public function set_up() { … … 507 508 } 508 509 510 public function notification_filter_callback() { 511 $this->filter_fired = current_action(); 512 } 513 509 514 /** 510 515 * @group bp_core_process_spammer_status 511 516 */ 512 517 public function test_bp_core_process_spammer_status_make_spam_user_filter() { 513 add_filter( 'make_spam_user', array( $this, 'notification_filter_callback' ) ); 514 515 $u1 = self::factory()->user->create(); 518 $u1 = self::factory()->user->create(); 519 520 add_action( 'make_spam_user', array( $this, 'notification_filter_callback' ) ); 521 516 522 $n = bp_core_process_spammer_status( $u1, 'spam' ); 517 523 518 remove_ filter( 'make_spam_user', array( $this, 'notification_filter_callback' ) );524 remove_action( 'make_spam_user', array( $this, 'notification_filter_callback' ) ); 519 525 520 526 $this->assertSame( 'make_spam_user', $this->filter_fired ); 521 522 527 } 523 528 … … 526 531 $s = bp_core_process_spammer_status( $u1, 'spam' ); 527 532 528 add_ filter( 'make_ham_user', array( $this, 'notification_filter_callback' ) );533 add_action( 'make_ham_user', array( $this, 'notification_filter_callback' ) ); 529 534 530 535 $h = bp_core_process_spammer_status( $u1, 'ham' ); 531 536 532 remove_ filter( 'make_ham_user', array( $this, 'notification_filter_callback' ) );537 remove_action( 'make_ham_user', array( $this, 'notification_filter_callback' ) ); 533 538 534 539 $this->assertSame( 'make_ham_user', $this->filter_fired ); … … 537 542 538 543 public function test_bp_core_process_spammer_status_bp_make_spam_user_filter() { 539 add_ filter( 'bp_make_spam_user', array( $this, 'notification_filter_callback' ) );544 add_action( 'bp_make_spam_user', array( $this, 'notification_filter_callback' ) ); 540 545 541 546 $u1 = self::factory()->user->create(); 542 547 $n = bp_core_process_spammer_status( $u1, 'spam' ); 543 548 544 remove_ filter( 'bp_make_spam_user', array( $this, 'notification_filter_callback' ) );549 remove_action( 'bp_make_spam_user', array( $this, 'notification_filter_callback' ) ); 545 550 546 551 $this->assertSame( 'bp_make_spam_user', $this->filter_fired ); … … 549 554 550 555 public function test_bp_core_process_spammer_status_bp_make_ham_user_filter() { 551 add_ filter( 'bp_make_ham_user', array( $this, 'notification_filter_callback' ) );556 add_action( 'bp_make_ham_user', array( $this, 'notification_filter_callback' ) ); 552 557 553 558 $u1 = self::factory()->user->create(); 554 559 $n = bp_core_process_spammer_status( $u1, 'ham' ); 555 560 556 remove_ filter( 'bp_make_ham_user', array( $this, 'notification_filter_callback' ) );561 remove_action( 'bp_make_ham_user', array( $this, 'notification_filter_callback' ) ); 557 562 558 563 $this->assertSame( 'bp_make_ham_user', $this->filter_fired ); … … 583 588 $site = get_site( $b1 ); 584 589 $this->assertEmpty( $site->spam ); 585 }586 587 public function notification_filter_callback( $value ) {588 $this->filter_fired = current_filter();589 return $value;590 590 } 591 591
Note: See TracChangeset
for help on using the changeset viewer.