Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/15/2015 08:41:50 PM (12 years ago)
Author:
boonebgorges
Message:

Parse arguments correctly in bp_register_member_type().

Custom labels were not being properly set due to a logic error in the
function.

Props Offereins.
See #6125.

File:
1 edited

Legend:

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

    r9210 r9360  
    3131                        $this->assertSame( 'Foo', $label );
    3232                }
     33        }
     34
     35        /**
     36         * @ticket BP6125
     37         */
     38        public function test_bp_register_member_type_should_respect_custom_name_label() {
     39                $object = bp_register_member_type( 'foo', array(
     40                        'labels' => array(
     41                                'name' => 'Bar',
     42                        ),
     43                ) );
     44
     45                // 'singular_name' falls back on 'name'.
     46                $this->assertSame( 'Bar', $object->labels['name'] );
     47                $this->assertSame( 'Bar', $object->labels['singular_name'] );
     48        }
     49
     50        /**
     51         * @ticket BP6125
     52         */
     53        public function test_bp_register_member_type_should_respect_custom_singular_name_label() {
     54                $object = bp_register_member_type( 'foo', array(
     55                        'labels' => array(
     56                                'singular_name' => 'Bar',
     57                        ),
     58                ) );
     59
     60                // 'name' is set to upper-case version of member type name.
     61                $this->assertSame( 'Foo', $object->labels['name'] );
     62                $this->assertSame( 'Bar', $object->labels['singular_name'] );
    3363        }
    3464
Note: See TracChangeset for help on using the changeset viewer.