Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/21/2016 10:40:12 PM (3 years ago)
Author:
r-a-y
Message:

Groups: In bp_groups_register_group_type(), introduce new arguments for frontend integration.

This commit introduces the following $args parameters:

  • 'has_directory'
  • 'show_in_create_screen'
  • 'show_in_list'
  • 'description'

Read the inline documentation for full information. The Group Types codex
article will be updated to outline these parameters.

See #7210.

File:
1 edited

Legend:

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

    r11142 r11144  
    265265    }
    266266
     267    public function test_bp_groups_register_group_type_show_in_list_true_when_show_in_create_screen_true() {
     268        $object = bp_groups_register_group_type( 'foo', array(
     269            'show_in_create_screen' => true,
     270        ) );
     271
     272        $this->assertTrue( $object->show_in_list );
     273    }
     274
     275    public function test_bp_groups_register_group_type_show_in_list_false_when_show_in_create_screen_false() {
     276        $object = bp_groups_register_group_type( 'foo', array(
     277            'show_in_create_screen' => false,
     278        ) );
     279
     280        $this->assertFalse( $object->show_in_list );
     281    }
     282
     283    public function test_bp_groups_register_group_type_show_in_list_false_and_show_in_create_screen_true() {
     284        $object = bp_groups_register_group_type( 'foo', array(
     285            'show_in_create_screen' => true,
     286            'show_in_list' => false,
     287        ) );
     288
     289        $this->assertFalse( $object->show_in_list );
     290    }
     291
     292    public function test_bp_groups_set_group_type_should_remove_types_when_passing_an_empty_value() {
     293        $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
     294        bp_groups_register_group_type( 'foo' );
     295        bp_groups_set_group_type( $g, 'foo' );
     296
     297        // Make sure it's set up.
     298        $this->assertSame( 'foo', bp_groups_get_group_type( $g ) );
     299
     300        $this->assertSame( array(), bp_groups_set_group_type( $g, '' ) );
     301        $this->assertFalse( bp_groups_get_group_type( $g ) );
     302    }
     303
    267304    public function test_bp_groups_set_group_type_should_set_multiple_types_when_passing_array_of_types() {
    268305        $g = $this->factory->group->create( array( 'creator_id' => self::$u1 ) );
Note: See TracChangeset for help on using the changeset viewer.