Skip to:
Content

BuddyPress.org

Ticket #7234: 7234.3.diff

File 7234.3.diff, 1.2 KB (added by jdgrimes, 7 years ago)
  • tests/phpunit/includes/factory.php

     
    157157                $this->default_generation_definitions = array(
    158158                        'sender_id'  => get_current_user_id(),
    159159                        'thread_id'  => 0,
    160                         'recipients' => array(),
    161160                        'subject'    => new WP_UnitTest_Generator_Sequence( 'Message subject %s' ),
    162161                        'content'    => new WP_UnitTest_Generator_Sequence( 'Message content %s' ),
    163162                        'date_sent'  => bp_core_current_time(),
     
    165164        }
    166165
    167166        function create_object( $args ) {
     167                if ( empty( $args['sender_id'] ) ) {
     168                        $args['sender_id'] = $this->factory->user->create();
     169                }
     170               
     171                if ( empty( $args['recipients'] ) ) {
     172                        $args['recipients'] = $this->factory->user->create();
     173                }
     174
    168175                $message_id = messages_new_message( $args );
    169176                return $message_id;
    170177        }
    171178
    172         function update_object( $group_id, $fields ) {
     179        function update_object( $message_id, $fields ) {
    173180                // todo
    174181        }
    175182
    176         function get_object_by_id( $group_id ) {
    177                 // todo
     183        function get_object_by_id( $message_id ) {
     184                return new BP_Messages_Message( $message_id );
    178185        }
    179186}
    180187