Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/09/2013 02:11:52 PM (9 years ago)
Author:
boonebgorges
Message:

In test suite, factory->activity->create() should return an id, not an object

Two reasons: The value that's almost always needed is an ID, and it's more
consistent with WP's factories.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/testcases/activity/class.BP_Activity_Activity.php

    r7039 r7047  
    2626
    2727        $result = BP_Activity_Activity::check_exists_by_content( $content );
    28         $this->assertEquals( $activity->id, $result );
     28        $this->assertEquals( $activity, $result );
    2929    }
    3030
     
    3939        ) );
    4040
    41         BP_Activity_Activity::delete_activity_item_comments( $parent_activity->id );
     41        BP_Activity_Activity::delete_activity_item_comments( $parent_activity );
    4242
    4343        $result = BP_Activity_Activity::get( array( 'in' => wp_list_pluck( $comments, 'id' ), ) );
     
    5353        ) );
    5454
    55         bp_activity_update_meta( $activity->id, 'Paul', 'is cool' );
    56         BP_Activity_Activity::delete_activity_meta_entries( $activity->id );
     55        bp_activity_update_meta( $activity, 'Paul', 'is cool' );
     56        BP_Activity_Activity::delete_activity_meta_entries( $activity );
    5757
    58         $meta = bp_activity_get_meta( $activity->id, 'Paul' );
     58        $meta = bp_activity_get_meta( $activity, 'Paul' );
    5959        $this->assertFalse( $meta );
    6060    }
     
    6868
    6969        $activity = BP_Activity_Activity::get( array(
    70             'in'          => $activity->id,
     70            'in'          => $activity,
    7171            'show_hidden' => true,
    7272        ) );
     
    7777        $a1 = $this->factory->activity->create();
    7878        $a2 = $this->factory->activity->create();
    79         bp_activity_update_meta( $a1->id, 'foo', 'bar' );
     79        bp_activity_update_meta( $a1, 'foo', 'bar' );
    8080
    8181        $activity = BP_Activity_Activity::get( array(
     
    8888        ) );
    8989        $ids = wp_list_pluck( $activity['activities'], 'id' );
    90         $this->assertEquals( $ids, array( $a1->id ) );
     90        $this->assertEquals( $ids, array( $a1 ) );
    9191    }
    9292}
Note: See TracChangeset for help on using the changeset viewer.