Skip to:
Content

BuddyPress.org

Ticket #6535: 6535.unittest.patch

File 6535.unittest.patch, 987 bytes (added by r-a-y, 10 years ago)
  • tests/phpunit/testcases/messages/functions.php

    diff --git tests/phpunit/testcases/messages/functions.php tests/phpunit/testcases/messages/functions.php
    index 949d129..139371f 100644
    class BP_Tests_Messages_Functions extends BP_UnitTestCase { 
    4141                $this->assertEquals( 1, messages_get_unread_count( $u2 ) );
    4242        }
    4343
     44        /**
     45         * @group messages_new_message
     46         */
     47        public function test_messages_new_message_invalid_recipient_error_message() {
     48                $u1 = $this->factory->user->create();
     49
     50                // attempt to send a private message to an invalid username
     51                $t1 = messages_new_message( array(
     52                        'sender_id'  => $u1,
     53                        'recipients' => array( 'homerglumpkin' ),
     54                        'subject'    => 'A new message',
     55                        'content'    => 'Hey there!',
     56                        'error_type' => 'wp_error'
     57                ) );
     58
     59                $this->assertSame( 'Message could not be sent because you have entered an invalid username. Please try again.', $t1->get_error_message() );
     60        }
    4461}