Skip to:
Content

BuddyPress.org

Ticket #6188: 6188.2.tests.diff

File 6188.2.tests.diff, 1.1 KB (added by Mamaduka, 6 years ago)
  • tests/phpunit/testcases/members/types.php

    diff --git tests/phpunit/testcases/members/types.php tests/phpunit/testcases/members/types.php
    index 3871dd6..0c64094 100644
    class BP_Tests_Members_Types extends BP_UnitTestCase { 
    235235
    236236                $this->assertSame( 'foo', bp_get_member_type( $new_user_id, true ) );
    237237        }
     238
     239        /**
     240         * @group bp_remove_member_type
     241         */
     242        public function test_bp_remove_member_type_remove_signle_type() {
     243                $u = $this->factory->user->create();
     244                bp_register_member_type( 'foo' );
     245                bp_register_member_type( 'bar' );
     246                bp_set_member_type( $u, 'foo' );
     247                bp_set_member_type( $u, 'bar', true );
     248
     249                // Remove type
     250                bp_remove_member_type( $u, 'foo' );
     251
     252                $this->assertSame( 'bar', bp_get_member_type( $u, true ) );
     253        }
     254
     255        /**
     256         * @group bp_remove_member_type
     257         */
     258        public function test_bp_remove_member_type_non_existing_type_for_user() {
     259                $u = $this->factory->user->create();
     260                bp_register_member_type( 'foo' );
     261                bp_register_member_type( 'bar' );
     262                bp_set_member_type( $u, 'foo' );
     263
     264                $this->assertFalse( bp_remove_member_type( $u, 'bar' ) );
     265        }
    238266}