Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/03/2017 07:44:10 PM (4 years ago)
Author:
boonebgorges
Message:

Use static factory method throughout PHPUnit tests.

See #7620.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/friends/activity.php

    r10748 r11737  
    1111     */
    1212    public function test_bp_friends_format_activity_action_friendship_accepted() {
    13         $u1 = $this->factory->user->create();
    14         $u2 = $this->factory->user->create();
    15 
    16         $a = $this->factory->activity->create( array(
     13        $u1 = self::factory()->user->create();
     14        $u2 = self::factory()->user->create();
     15
     16        $a = self::factory()->activity->create( array(
    1717            'component' => buddypress()->friends->id,
    1818            'type' => 'friendship_accepted',
     
    3333     */
    3434    public function test_bp_friends_format_activity_action_friendship_created() {
    35         $u1 = $this->factory->user->create();
    36         $u2 = $this->factory->user->create();
    37 
    38         $a = $this->factory->activity->create( array(
     35        $u1 = self::factory()->user->create();
     36        $u2 = self::factory()->user->create();
     37
     38        $a = self::factory()->activity->create( array(
    3939            'component' => buddypress()->friends->id,
    4040            'type' => 'friendship_created',
     
    5656        $old_user = get_current_user_id();
    5757
    58         $u1 = $this->factory->user->create();
    59         $u2 = $this->factory->user->create();
     58        $u1 = self::factory()->user->create();
     59        $u2 = self::factory()->user->create();
    6060
    6161        friends_add_friend( $u2, $u1 );
     
    7070
    7171        // Random activities
    72         $au1 = $this->factory->activity->create( array( 'user_id' => $u1 ) );
    73         $au2 = $this->factory->activity->create( array( 'user_id' => $u2 ) );
     72        $au1 = self::factory()->activity->create( array( 'user_id' => $u1 ) );
     73        $au2 = self::factory()->activity->create( array( 'user_id' => $u2 ) );
    7474
    7575        $fc_act = bp_activity_get( array(
     
    103103        $old_user = get_current_user_id();
    104104
    105         $u1 = $this->factory->user->create();
    106         $u2 = $this->factory->user->create();
     105        $u1 = self::factory()->user->create();
     106        $u2 = self::factory()->user->create();
    107107
    108108        friends_add_friend( $u2, $u1 );
     
    141141        $old_user = get_current_user_id();
    142142
    143         $u1 = $this->factory->user->create();
    144         $u2 = $this->factory->user->create();
     143        $u1 = self::factory()->user->create();
     144        $u2 = self::factory()->user->create();
    145145        $users = array( $u1, $u2 );
    146146
     
    155155        $this->set_current_user( $old_user );
    156156
    157         $users[] = $this->factory->user->create();
    158         $users[] = $this->factory->user->create();
     157        $users[] = self::factory()->user->create();
     158        $users[] = self::factory()->user->create();
    159159
    160160        foreach( $users as $u ) {
     
    192192        $old_user = get_current_user_id();
    193193
    194         $u1 = $this->factory->user->create();
    195         $u2 = $this->factory->user->create();
     194        $u1 = self::factory()->user->create();
     195        $u2 = self::factory()->user->create();
    196196
    197197        friends_add_friend( $u2, $u1 );
     
    222222    public function test_delete_user_with_no_activities() {
    223223        $old_user = get_current_user_id();
    224         $u1 = $this->factory->user->create();
     224        $u1 = self::factory()->user->create();
    225225        $this->set_current_user( $u1 );
    226226
Note: See TracChangeset for help on using the changeset viewer.