Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/02/2024 06:35:51 AM (4 months ago)
Author:
imath
Message:

Spamming users/Multisite: WP spam marker value is now the '1' string

See https://core.trac.wordpress.org/changeset/58261/

Fixes #9166
Closes https://github.com/buddypress/buddypress/pull/309

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/members/functions.php

    r13433 r13894  
    66class BP_Tests_Members_Functions extends BP_UnitTestCase {
    77    protected $permalink_structure = '';
     8    protected $filter_fired = '';
    89
    910    public function set_up() {
     
    507508    }
    508509
     510    public function notification_filter_callback() {
     511        $this->filter_fired = current_action();
     512    }
     513
    509514    /**
    510515     * @group bp_core_process_spammer_status
    511516     */
    512517    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
    516522        $n = bp_core_process_spammer_status( $u1, 'spam' );
    517523
    518         remove_filter( 'make_spam_user', array( $this, 'notification_filter_callback' ) );
     524        remove_action( 'make_spam_user', array( $this, 'notification_filter_callback' ) );
    519525
    520526        $this->assertSame( 'make_spam_user', $this->filter_fired );
    521 
    522527    }
    523528
     
    526531        $s  = bp_core_process_spammer_status( $u1, 'spam' );
    527532
    528         add_filter( 'make_ham_user', array( $this, 'notification_filter_callback' ) );
     533        add_action( 'make_ham_user', array( $this, 'notification_filter_callback' ) );
    529534
    530535        $h = bp_core_process_spammer_status( $u1, 'ham' );
    531536
    532         remove_filter( 'make_ham_user', array( $this, 'notification_filter_callback' ) );
     537        remove_action( 'make_ham_user', array( $this, 'notification_filter_callback' ) );
    533538
    534539        $this->assertSame( 'make_ham_user', $this->filter_fired );
     
    537542
    538543    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' ) );
    540545
    541546        $u1 = self::factory()->user->create();
    542547        $n = bp_core_process_spammer_status( $u1, 'spam' );
    543548
    544         remove_filter( 'bp_make_spam_user', array( $this, 'notification_filter_callback' ) );
     549        remove_action( 'bp_make_spam_user', array( $this, 'notification_filter_callback' ) );
    545550
    546551        $this->assertSame( 'bp_make_spam_user', $this->filter_fired );
     
    549554
    550555    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' ) );
    552557
    553558        $u1 = self::factory()->user->create();
    554559        $n = bp_core_process_spammer_status( $u1, 'ham' );
    555560
    556         remove_filter( 'bp_make_ham_user', array( $this, 'notification_filter_callback' ) );
     561        remove_action( 'bp_make_ham_user', array( $this, 'notification_filter_callback' ) );
    557562
    558563        $this->assertSame( 'bp_make_ham_user', $this->filter_fired );
     
    583588        $site = get_site( $b1 );
    584589        $this->assertEmpty( $site->spam );
    585     }
    586 
    587     public function notification_filter_callback( $value ) {
    588         $this->filter_fired = current_filter();
    589         return $value;
    590590    }
    591591
Note: See TracChangeset for help on using the changeset viewer.