Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/17/2017 06:57:32 PM (3 years ago)
Author:
dcavins
Message:

Introduce groups_get_id_by_previous_slug().

Introduce groups_get_id_by_previous_slug() function to find groups
that once had the requested slug.

See #6014.

File:
1 edited

Legend:

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

    r11555 r11558  
    826826    }
    827827
     828    /**
     829     * @group groups_get_id_by_previous_slug
     830     */
     831    public function test_groups_get_id_by_previous_slug() {
     832        $slug = 'circe';
     833        $g1 = $this->factory->group->create( array( 'slug' => $slug ) );
     834        $g2 = $this->factory->group->create( array( 'slug' => 'loom' ) );
     835
     836        groups_edit_base_group_details( array(
     837            'group_id'       => $g1,
     838            'slug'           => 'newslug',
     839        ) );
     840
     841        // Function should return the group ID as an integer.
     842        $this->assertSame( $g1, groups_get_id_by_previous_slug( $slug ) );
     843    }
     844
     845    /**
     846     * @group groups_get_id_by_previous_slug
     847     */
     848    public function test_groups_get_id_by_previous_slug_null_no_results() {
     849        $this->assertNull( groups_get_id_by_previous_slug( 'woohoo' ) );
     850    }
     851
    828852}
Note: See TracChangeset for help on using the changeset viewer.