Skip to:
Content

BuddyPress.org

Ticket #6969: 6969.01.patch

File 6969.01.patch, 1.3 KB (added by r-a-y, 6 years ago)
  • src/bp-core/classes/class-bp-email-recipient.php

     
    5656                $name = sanitize_text_field( $name );
    5757
    5858                // User ID, WP_User object.
    59                 if ( is_int( $email_or_user ) || is_object( $email_or_user ) ) {
     59                if ( is_numeric( $email_or_user ) || is_object( $email_or_user ) ) {
    6060                        $this->user_object = is_object( $email_or_user ) ? $email_or_user : get_user_by( 'id', $email_or_user );
    6161
    6262                        if ( $this->user_object ) {
  • tests/phpunit/testcases/core/class-bp-email-recipient.php

     
    6363                $this->assertEmpty( $recipient->get_name() );
    6464        }
    6565
     66        public function test_return_with_string_numeric_user_id() {
     67                $recipient = new BP_Email_Recipient( (string) $this->u1 );
     68                $this->assertSame( 'test@example.com', $recipient->get_address() );
     69                $this->assertSame( 'Unit Test', $recipient->get_name() );
     70        }
     71
    6672        public function test_should_return_empty_string_if_user_id_id_invalid() {
    6773                $recipient = new BP_Email_Recipient( time() );
    6874