Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/13/2014 03:39:31 PM (12 years ago)
Author:
boonebgorges
Message:

Add Messages unit test factory class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/factory.php

    r8125 r8504  
    88                $this->activity = new BP_UnitTest_Factory_For_Activity( $this );
    99                $this->group = new BP_UnitTest_Factory_For_Group( $this );
     10                $this->message = new BP_UnitTest_Factory_For_Message( $this );
    1011                $this->xprofile_group = new BP_UnitTest_Factory_For_XProfileGroup( $this );
    1112                $this->xprofile_field = new BP_UnitTest_Factory_For_XProfileField( $this );
     
    100101}
    101102
     103class BP_UnitTest_Factory_For_Message extends WP_UnitTest_Factory_For_Thing {
     104
     105        function __construct( $factory = null ) {
     106                parent::__construct( $factory );
     107
     108                $this->default_generation_definitions = array(
     109                        'sender_id'  => get_current_user_id(),
     110                        'thread_id'  => 0,
     111                        'recipients' => array(),
     112                        'subject'    => new WP_UnitTest_Generator_Sequence( 'Message subject %s' ),
     113                        'content'    => new WP_UnitTest_Generator_Sequence( 'Message content %s' ),
     114                        'date_sent'  => bp_core_current_time(),
     115                );
     116        }
     117
     118        function create_object( $args ) {
     119                $message_id = messages_new_message( $args );
     120                return $message_id;
     121        }
     122
     123        function update_object( $group_id, $fields ) {
     124                // todo
     125        }
     126
     127        function get_object_by_id( $group_id ) {
     128                // todo
     129        }
     130}
     131
    102132class BP_UnitTest_Factory_For_XProfileGroup extends WP_UnitTest_Factory_For_Thing {
    103133
Note: See TracChangeset for help on using the changeset viewer.