Skip to:
Content

BuddyPress.org

Ticket #5979: 5979-tests.patch

File 5979-tests.patch, 1.5 KB (added by boonebgorges, 10 years ago)
  • tests/phpunit/testcases/members/functions.php

    diff --git tests/phpunit/testcases/members/functions.php tests/phpunit/testcases/members/functions.php
    index 4ce1b28..8439925 100644
    class BP_Tests_Members_Functions extends BP_UnitTestCase { 
    436436        }
    437437
    438438        /**
     439         * @group bp_core_process_spammer_status
     440         * @group cache
     441         */
     442        public function test_bp_core_process_spammer_status_should_delete_userdata_cache() {
     443                $u = $this->factory->user->create();
     444
     445                // Prime the cache.
     446                $q = new BP_User_Query( array(
     447                        'include' => array( $u ),
     448                ) );
     449
     450                $this->assertNotEmpty( wp_cache_get( 'bp_core_userdata_' . $u, 'bp' ) );
     451
     452                bp_core_process_spammer_status( $u, 'spam' );
     453
     454                $this->assertEmpty( wp_cache_get( 'bp_core_userdata_' . $u, 'bp' ) );
     455        }
     456
     457        /**
     458         * @group bp_core_process_spammer_status
     459         * @group cache
     460         */
     461        public function test_bp_core_process_spammer_status_should_delete_member_count_cache() {
     462                $u = $this->factory->user->create();
     463
     464                // Prime the cache.
     465                $q = new BP_User_Query( array(
     466                        'include' => array( $u ),
     467                ) );
     468
     469                $total_before = bp_core_get_total_member_count();
     470                $active_before = bp_core_get_active_member_count();
     471                bp_core_process_spammer_status( $u, 'spam' );
     472
     473                $this->assertEquals( $total_before - 1, bp_core_get_total_member_count() );
     474                $this->assertEquals( $active_before - 1, bp_core_get_active_member_count() );
     475        }
     476
     477        /**
    439478         * @group bp_update_user_last_activity
    440479         * @global object $wpdb
    441480         * @param  string $key