Skip to:
Content

BuddyPress.org

Changeset 11737


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

Use static factory method throughout PHPUnit tests.

See #7620.

Location:
trunk/tests/phpunit/testcases
Files:
86 edited

Legend:

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

    r11256 r11737  
    1616        ) );
    1717
    18         $post_id = $this->factory->post->create( array(
     18        $post_id = self::factory()->post->create( array(
    1919            'post_status' => 'publish',
    2020            'post_type'   => 'foo',
     
    4040        ) );
    4141
    42         $post_id = $this->factory->post->create( array(
     42        $post_id = self::factory()->post->create( array(
    4343            'post_status' => 'publish',
    4444            'post_type'   => 'foo',
     
    5858     */
    5959    public function test_bp_activity_catch_transition_post_type_status_publish_existing_post() {
    60         $u = $this->factory->user->create();
     60        $u = self::factory()->user->create();
    6161
    6262        $labels = array(
     
    8585
    8686        // Create the initial post.
    87         $p = $this->factory->post->create( array(
     87        $p = self::factory()->post->create( array(
    8888            'post_author' => $u,
    8989            'post_type'   => 'foo',
     
    119119        ) );
    120120
    121         $post_id = $this->factory->post->create( array(
     121        $post_id = self::factory()->post->create( array(
    122122            'post_status' => 'publish',
    123123            'post_type'   => 'foo',
     
    151151        ) );
    152152
    153         $post_id = $this->factory->post->create( array(
     153        $post_id = self::factory()->post->create( array(
    154154            'post_status' => 'publish',
    155155            'post_type'   => 'foo',
  • trunk/tests/phpunit/testcases/activity/cache.php

    r11076 r11737  
    1010     */
    1111    public function test_bp_activity_update_meta_cache() {
    12         $a1 = $this->factory->activity->create();
    13         $a2 = $this->factory->activity->create();
     12        $a1 = self::factory()->activity->create();
     13        $a2 = self::factory()->activity->create();
    1414
    1515        // Set up some data
     
    5959     */
    6060    public function test_bp_activity_clear_cache_for_activity() {
    61         $u = $this->factory->user->create();
    62 
    63         $a = $this->factory->activity->create( array(
     61        $u = self::factory()->user->create();
     62
     63        $a = self::factory()->activity->create( array(
    6464            'component'     => buddypress()->activity->id,
    6565            'type'          => 'activity_update',
     
    9292        global $wpdb;
    9393
    94         $u = $this->factory->user->create();
    95         $a = $this->factory->activity->create( array(
     94        $u = self::factory()->user->create();
     95        $a = self::factory()->activity->create( array(
    9696            'component'     => buddypress()->activity->id,
    9797            'type'          => 'activity_update',
     
    123123        global $wpdb;
    124124
    125         $u = $this->factory->user->create();
    126         $a = $this->factory->activity->create( array(
     125        $u = self::factory()->user->create();
     126        $a = self::factory()->activity->create( array(
    127127            'component'     => buddypress()->activity->id,
    128128            'type'          => 'activity_update',
     
    162162        global $wpdb;
    163163
    164         $u = $this->factory->user->create();
    165         $a1 = $this->factory->activity->create( array(
     164        $u = self::factory()->user->create();
     165        $a1 = self::factory()->activity->create( array(
    166166            'component'     => buddypress()->activity->id,
    167167            'type'          => 'activity_update',
     
    179179
    180180        // Bust the cache.
    181         $a2 = $this->factory->activity->create( array(
     181        $a2 = self::factory()->activity->create( array(
    182182            'component'     => buddypress()->activity->id,
    183183            'type'          => 'activity_update',
     
    204204        global $wpdb;
    205205
    206         $u = $this->factory->user->create();
    207         $a = $this->factory->activity->create( array(
     206        $u = self::factory()->user->create();
     207        $a = self::factory()->activity->create( array(
    208208            'component'     => buddypress()->activity->id,
    209209            'type'          => 'activity_update',
     
    221221
    222222        // Bust the cache.
    223         $this->factory->activity->create( array(
     223        self::factory()->activity->create( array(
    224224            'id'            => $a,
    225225            'component'     => buddypress()->activity->id,
     
    244244        global $wpdb;
    245245
    246         $u = $this->factory->user->create();
    247         $a = $this->factory->activity->create( array(
     246        $u = self::factory()->user->create();
     247        $a = self::factory()->activity->create( array(
    248248            'component'     => buddypress()->activity->id,
    249249            'type'          => 'activity_update',
     
    281281        global $wpdb;
    282282
    283         $activities = $this->factory->activity->create_many( 2 );
     283        $activities = self::factory()->activity->create_many( 2 );
    284284        bp_activity_add_meta( $activities[0], 'foo', 'bar' );
    285285
     
    309309        global $wpdb;
    310310
    311         $activities = $this->factory->activity->create_many( 2 );
     311        $activities = self::factory()->activity->create_many( 2 );
    312312        bp_activity_add_meta( $activities[0], 'foo', 'bar' );
    313313        bp_activity_add_meta( $activities[1], 'foo', 'baz' );
     
    338338        global $wpdb;
    339339
    340         $activities = $this->factory->activity->create_many( 2 );
     340        $activities = self::factory()->activity->create_many( 2 );
    341341        bp_activity_add_meta( $activities[0], 'foo', 'bar' );
    342342        bp_activity_add_meta( $activities[1], 'foo', 'bar' );
  • trunk/tests/phpunit/testcases/activity/class.BP_Activity_Activity.php

    r11312 r11737  
    1010    public function test_check_exists_by_content() {
    1111        $content  = 'A classy girl who know how to enjoy the freedom of a cup of coffee';
    12         $activity = $this->factory->activity->create( array(
     12        $activity = self::factory()->activity->create( array(
    1313            'content' => $content,
    1414            'type'    => 'activity_update',
     
    2323     */
    2424    public function test_delete_activity_item_comments() {
    25         $parent_activity = $this->factory->activity->create( array(
     25        $parent_activity = self::factory()->activity->create( array(
    2626            'type' => 'activity_update',
    2727        ) );
    2828
    29         $comments = $this->factory->activity->create_many( 3, array(
     29        $comments = self::factory()->activity->create_many( 3, array(
    3030            'item_id' => $parent_activity,
    3131            'type'    => 'activity_comment',
     
    4444     */
    4545    public function test_delete_activity_meta_entries() {
    46         $activity = $this->factory->activity->create( array(
     46        $activity = self::factory()->activity->create( array(
    4747            'type' => 'activity_update',
    4848        ) );
     
    6161     */
    6262    public function test_get_with_fields_parameter_by_id() {
    63         $a = $this->factory->activity->create_many( 3, array(
     63        $a = self::factory()->activity->create_many( 3, array(
    6464            'type' => 'activity_update',
    6565        ) );
     
    7575     */
    7676    public function test_hide_all_for_user() {
    77         $activity = $this->factory->activity->create( array(
     77        $activity = self::factory()->activity->create( array(
    7878            'type' => 'activity_update',
    7979        ) );
     
    9393     */
    9494    public function test_get_with_meta_query() {
    95         $a1 = $this->factory->activity->create();
    96         $a2 = $this->factory->activity->create();
     95        $a1 = self::factory()->activity->create();
     96        $a2 = self::factory()->activity->create();
    9797        bp_activity_update_meta( $a1, 'foo', 'bar' );
    9898
     
    114114    public function test_get_with_meta_query_two_clauses_with_or_relation() {
    115115        $now = time();
    116         $a1 = $this->factory->activity->create( array(
     116        $a1 = self::factory()->activity->create( array(
    117117            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    118118        ) );
    119         $a2 = $this->factory->activity->create( array(
     119        $a2 = self::factory()->activity->create( array(
    120120            'recorded_time' => date( 'Y-m-d H:i:s', $now - 60 ),
    121121        ) );
    122         $a3 = $this->factory->activity->create( array(
     122        $a3 = self::factory()->activity->create( array(
    123123            'recorded_time' => date( 'Y-m-d H:i:s', $now - 120 ),
    124124        ) );
     
    157157        }
    158158
    159         $a1 = $this->factory->activity->create();
    160         $a2 = $this->factory->activity->create( array(
     159        $a1 = self::factory()->activity->create();
     160        $a2 = self::factory()->activity->create( array(
    161161            'recorded_time' => '2001-01-01 12:00'
    162162        ) );
    163         $a3 = $this->factory->activity->create( array(
     163        $a3 = self::factory()->activity->create( array(
    164164            'recorded_time' => '2005-01-01 12:00'
    165165        ) );
     
    188188        }
    189189
    190         $a1 = $this->factory->activity->create();
    191         $a2 = $this->factory->activity->create( array(
     190        $a1 = self::factory()->activity->create();
     191        $a2 = self::factory()->activity->create( array(
    192192            'recorded_time' => '2001-01-01 12:00'
    193193        ) );
    194         $a3 = $this->factory->activity->create( array(
     194        $a3 = self::factory()->activity->create( array(
    195195            'recorded_time' => '2005-01-01 12:00'
    196196        ) );
     
    221221        }
    222222
    223         $a1 = $this->factory->activity->create();
    224         $a2 = $this->factory->activity->create( array(
     223        $a1 = self::factory()->activity->create();
     224        $a2 = self::factory()->activity->create( array(
    225225            'recorded_time' => '2001-01-01 12:00'
    226226        ) );
    227         $a3 = $this->factory->activity->create( array(
     227        $a3 = self::factory()->activity->create( array(
    228228            'recorded_time' => '2005-01-01 12:00'
    229229        ) );
     
    242242     */
    243243    public function test_get_with_search_terms() {
    244         $a1 = $this->factory->activity->create( array(
     244        $a1 = self::factory()->activity->create( array(
    245245            'content' => 'Boone is a cool guy',
    246246        ) );
    247         $a2 = $this->factory->activity->create( array(
     247        $a2 = self::factory()->activity->create( array(
    248248            'content' => 'No he isn\'t',
    249249        ) );
     
    260260     */
    261261    public function test_get_with_display_comments_threaded() {
    262         $u = $this->factory->user->create();
     262        $u = self::factory()->user->create();
    263263
    264264        $now = time();
    265         $a1 = $this->factory->activity->create( array(
     265        $a1 = self::factory()->activity->create( array(
    266266            'user_id' => $u,
    267267            'content' => 'Life Rules',
    268268            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    269269        ) );
    270         $a2 = $this->factory->activity->create( array(
     270        $a2 = self::factory()->activity->create( array(
    271271            'user_id' => $u,
    272272            'content' => 'Life Drools',
     
    303303    public function test_get_with_display_comments_stream() {
    304304        $now = time();
    305         $a1 = $this->factory->activity->create( array(
     305        $a1 = self::factory()->activity->create( array(
    306306            'content' => 'Life Rules',
    307307            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    308308        ) );
    309         $a2 = $this->factory->activity->create( array(
     309        $a2 = self::factory()->activity->create( array(
    310310            'content' => 'Life Drools',
    311311            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
     
    336336    public function test_get_with_display_comments_false() {
    337337        $now = time();
    338         $a1 = $this->factory->activity->create( array(
     338        $a1 = self::factory()->activity->create( array(
    339339            'content' => 'Life Rules',
    340340            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    341341        ) );
    342         $a2 = $this->factory->activity->create( array(
     342        $a2 = self::factory()->activity->create( array(
    343343            'content' => 'Life Drools',
    344344            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
     
    362362    public function test_get_with_offset() {
    363363        $now = time();
    364         $a1 = $this->factory->activity->create( array(
     364        $a1 = self::factory()->activity->create( array(
    365365            'content' => 'Life Rules',
    366366            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    367367        ) );
    368         $a2 = $this->factory->activity->create( array(
     368        $a2 = self::factory()->activity->create( array(
    369369            'content' => 'Life Drools',
    370370            'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ),
    371371        ) );
    372         $a3 = $this->factory->activity->create( array(
     372        $a3 = self::factory()->activity->create( array(
    373373            'content' => 'Life Drools',
    374374            'recorded_time' => date( 'Y-m-d H:i:s', $now - 10 ),
     
    389389    public function test_get_with_since() {
    390390        $now = time();
    391         $a1 = $this->factory->activity->create( array(
     391        $a1 = self::factory()->activity->create( array(
    392392            'content' => 'Life Rules',
    393393            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    394394        ) );
    395         $a2 = $this->factory->activity->create( array(
     395        $a2 = self::factory()->activity->create( array(
    396396            'content' => 'Life Drools',
    397397            'recorded_time' => date( 'Y-m-d H:i:s', $now - 50 ),
    398398        ) );
    399         $a3 = $this->factory->activity->create( array(
     399        $a3 = self::factory()->activity->create( array(
    400400            'content' => 'Life Drools',
    401401            'recorded_time' => date( 'Y-m-d H:i:s', $now - 10 ),
     
    416416     */
    417417    public function test_get_with_count_total() {
    418         $a1 = $this->factory->activity->create();
    419         $a2 = $this->factory->activity->create();
     418        $a1 = self::factory()->activity->create();
     419        $a2 = self::factory()->activity->create();
    420420
    421421        $activity = BP_Activity_Activity::get( array(
     
    431431     */
    432432    public function test_get_with_count_total_false() {
    433         $a1 = $this->factory->activity->create();
    434         $a2 = $this->factory->activity->create();
     433        $a1 = self::factory()->activity->create();
     434        $a2 = self::factory()->activity->create();
    435435
    436436        $activity = BP_Activity_Activity::get( array(
     
    446446     */
    447447    public function test_get_with_count_total_default_to_false() {
    448         $a1 = $this->factory->activity->create();
    449         $a2 = $this->factory->activity->create();
     448        $a1 = self::factory()->activity->create();
     449        $a2 = self::factory()->activity->create();
    450450
    451451        $activity = BP_Activity_Activity::get();
     
    458458     */
    459459    public function test_get_id_with_item_id() {
    460         $a1 = $this->factory->activity->create( array(
     460        $a1 = self::factory()->activity->create( array(
    461461            'item_id' => 523,
    462462        ) );
    463         $a2 = $this->factory->activity->create( array(
     463        $a2 = self::factory()->activity->create( array(
    464464            'item_id' => 1888,
    465465        ) );
     
    473473     */
    474474    public function test_get_id_with_secondary_item_id() {
    475         $a1 = $this->factory->activity->create( array(
     475        $a1 = self::factory()->activity->create( array(
    476476            'secondary_item_id' => 523,
    477477        ) );
    478         $a2 = $this->factory->activity->create( array(
     478        $a2 = self::factory()->activity->create( array(
    479479            'secondary_content' => 1888,
    480480        ) );
     
    488488     */
    489489    public function test_delete_with_item_id() {
    490         $a1 = $this->factory->activity->create( array(
     490        $a1 = self::factory()->activity->create( array(
    491491            'item_id' => 523,
    492492        ) );
    493         $a2 = $this->factory->activity->create( array(
     493        $a2 = self::factory()->activity->create( array(
    494494            'item_id' => 1888,
    495495        ) );
     
    505505     */
    506506    public function test_delete_with_secondary_item_id() {
    507         $a1 = $this->factory->activity->create( array(
     507        $a1 = self::factory()->activity->create( array(
    508508            'secondary_item_id' => 523,
    509509        ) );
    510         $a2 = $this->factory->activity->create( array(
     510        $a2 = self::factory()->activity->create( array(
    511511            'secondary_item_id' => 1888,
    512512        ) );
     
    527527        $now = time();
    528528
    529         $u1 = $this->factory->user->create();
    530         $u2 = $this->factory->user->create();
    531 
    532         $a1 = $this->factory->activity->create( array(
     529        $u1 = self::factory()->user->create();
     530        $u2 = self::factory()->user->create();
     531
     532        $a1 = self::factory()->activity->create( array(
    533533            'content' => 'Life Rules',
    534534            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
     
    602602    public function test_get_last_updated() {
    603603        $now = time();
    604         $a1 = $this->factory->activity->create( array(
     604        $a1 = self::factory()->activity->create( array(
    605605            'recorded_time' => date( 'Y-m-d H:i:s', $now - 500 ),
    606606        ) );
    607         $a2 = $this->factory->activity->create( array(
     607        $a2 = self::factory()->activity->create( array(
    608608            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    609609        ) );
    610         $a3 = $this->factory->activity->create( array(
     610        $a3 = self::factory()->activity->create( array(
    611611            'recorded_time' => date( 'Y-m-d H:i:s', $now - 300 ),
    612612        ) );
     
    619619     */
    620620    public function test_get_recorded_components_skip_last_activity_false() {
    621         $a1 = $this->factory->activity->create( array(
     621        $a1 = self::factory()->activity->create( array(
    622622            'component' => 'members',
    623623            'action' => 'last_activity',
    624624        ) );
    625         $a2 = $this->factory->activity->create( array(
     625        $a2 = self::factory()->activity->create( array(
    626626            'component' => 'groups',
    627627            'action' => 'created_group',
    628628        ) );
    629         $a3 = $this->factory->activity->create( array(
     629        $a3 = self::factory()->activity->create( array(
    630630            'component' => 'friends',
    631631            'action' => 'friendship_accepted',
     
    642642     */
    643643    public function test_get_recorded_components_skip_last_activity_true_filter_empty_component() {
    644         $a1 = $this->factory->activity->create( array(
     644        $a1 = self::factory()->activity->create( array(
    645645            'component' => 'members',
    646646            'action' => 'last_activity',
    647647        ) );
    648         $a2 = $this->factory->activity->create( array(
     648        $a2 = self::factory()->activity->create( array(
    649649            'component' => 'groups',
    650650            'action' => 'created_group',
    651651        ) );
    652         $a3 = $this->factory->activity->create( array(
     652        $a3 = self::factory()->activity->create( array(
    653653            'component' => 'friends',
    654654            'action' => 'friendship_accepted',
     
    665665     */
    666666    public function test_get_recorded_components_skip_last_activity_true_members_component_not_empty() {
    667         $a1 = $this->factory->activity->create( array(
     667        $a1 = self::factory()->activity->create( array(
    668668            'component' => 'members',
    669669            'action' => 'last_activity',
    670670        ) );
    671         $a2 = $this->factory->activity->create( array(
     671        $a2 = self::factory()->activity->create( array(
    672672            'component' => 'groups',
    673673            'action' => 'created_group',
    674674        ) );
    675         $a3 = $this->factory->activity->create( array(
     675        $a3 = self::factory()->activity->create( array(
    676676            'component' => 'friends',
    677677            'action' => 'friendship_accepted',
    678678        ) );
    679         $a4 = $this->factory->activity->create( array(
     679        $a4 = self::factory()->activity->create( array(
    680680            'component' => 'members',
    681681            'action' => 'foo',
     
    692692     */
    693693    public function test_get_recorded_components_skip_last_activity_true_la_in_multiple_components() {
    694         $a1 = $this->factory->activity->create( array(
     694        $a1 = self::factory()->activity->create( array(
    695695            'component' => 'members',
    696696            'action' => 'last_activity',
    697697        ) );
    698         $a2 = $this->factory->activity->create( array(
     698        $a2 = self::factory()->activity->create( array(
    699699            'component' => 'groups',
    700700            'action' => 'created_group',
    701701        ) );
    702         $a3 = $this->factory->activity->create( array(
     702        $a3 = self::factory()->activity->create( array(
    703703            'component' => 'friends',
    704704            'action' => 'friendship_accepted',
    705705        ) );
    706         $a4 = $this->factory->activity->create( array(
     706        $a4 = self::factory()->activity->create( array(
    707707            'component' => 'groups',
    708708            'action' => 'last_activity',
     
    726726
    727727        // Create the activity item with a manual activity string
    728         $a = $this->factory->activity->create( array(
     728        $a = self::factory()->activity->create( array(
    729729            'component' => 'foo',
    730730            'type' => 'bar',
     
    744744
    745745        // Create the activity item with a manual activity string
    746         $a = $this->factory->activity->create( array(
     746        $a = self::factory()->activity->create( array(
    747747            'component' => 'foo',
    748748            'type' => 'bar1',
     
    762762
    763763        // Create the activity item with a manual activity string
    764         $a = $this->factory->activity->create( array(
     764        $a = self::factory()->activity->create( array(
    765765            'component' => 'foo',
    766766            'type' => 'bar2',
     
    776776     */
    777777    public function test_nonexistent_activity_should_have_id_0_after_population() {
    778         $a = $this->factory->activity->create();
     778        $a = self::factory()->activity->create();
    779779        bp_activity_delete_by_activity_id( $a );
    780780
  • trunk/tests/phpunit/testcases/activity/filters.php

    r10960 r11737  
    1010     */
    1111    public function test_bp_activity_at_name_filter() {
    12         $u1 = $this->factory->user->create( array(
     12        $u1 = self::factory()->user->create( array(
    1313            'user_login' => 'foobarbaz',
    1414            'user_nicename' => 'foobarbaz',
    1515        ) );
    1616
    17         $u2 = $this->factory->user->create( array(
     17        $u2 = self::factory()->user->create( array(
    1818            'user_login' => 'foo2',
    1919            'user_nicename' => 'foo2',
  • trunk/tests/phpunit/testcases/activity/functions.php

    r11583 r11737  
    2828
    2929        // create an activity update
    30         $activity = $this->factory->activity->create( array(
     30        $activity = self::factory()->activity->create( array(
    3131            'type' => 'activity_update'
    3232        ) );
     
    5757
    5858        // create an activity update
    59         $this->factory->activity->create( $criteria );
    60         $this->factory->activity->create( $criteria );
    61         $this->factory->activity->create( $criteria );
    62         $this->factory->activity->create( $criteria );
     59        self::factory()->activity->create( $criteria );
     60        self::factory()->activity->create( $criteria );
     61        self::factory()->activity->create( $criteria );
     62        self::factory()->activity->create( $criteria );
    6363
    6464        // now delete the activity items
     
    8383
    8484        // create an activity update
    85         $this->factory->activity->create( $criteria );
    86         $this->factory->activity->create( $criteria );
    87         $this->factory->activity->create( $criteria );
    88         $this->factory->activity->create( $criteria );
     85        self::factory()->activity->create( $criteria );
     86        self::factory()->activity->create( $criteria );
     87        self::factory()->activity->create( $criteria );
     88        self::factory()->activity->create( $criteria );
    8989
    9090        // now delete the activity items
     
    109109
    110110        // create an activity update
    111         $this->factory->activity->create( $criteria );
    112         $this->factory->activity->create( $criteria );
    113         $this->factory->activity->create( $criteria );
    114         $this->factory->activity->create( $criteria );
     111        self::factory()->activity->create( $criteria );
     112        self::factory()->activity->create( $criteria );
     113        self::factory()->activity->create( $criteria );
     114        self::factory()->activity->create( $criteria );
    115115
    116116        // now delete the activity items
     
    130130
    131131        // create an activity update
    132         $activity = $this->factory->activity->create( array(
     132        $activity = self::factory()->activity->create( array(
    133133            'type' => 'activity_update'
    134134        ) );
     
    153153
    154154        // create an activity update
    155         $activity = $this->factory->activity->create( array(
     155        $activity = self::factory()->activity->create( array(
    156156            'type' => 'activity_update'
    157157        ) );
     
    188188
    189189        // create an activity update
    190         $parent_activity = $this->factory->activity->create( array(
     190        $parent_activity = self::factory()->activity->create( array(
    191191            'type' => 'activity_update',
    192192        ) );
    193193
    194194        // create some activity comments
    195         $comment_one = $this->factory->activity->create( array(
     195        $comment_one = self::factory()->activity->create( array(
    196196            'type'              => 'activity_comment',
    197197            'item_id'           => $parent_activity,
     
    199199        ) );
    200200
    201         $comment_two = $this->factory->activity->create( array(
     201        $comment_two = self::factory()->activity->create( array(
    202202            'type'              => 'activity_comment',
    203203            'item_id'           => $parent_activity,
     
    227227
    228228        // create an activity update
    229         $parent_activity = $this->factory->activity->create( array(
     229        $parent_activity = self::factory()->activity->create( array(
    230230            'type' => 'activity_update',
    231231        ) );
    232232
    233233        // create some activity comments
    234         $comment_one = $this->factory->activity->create( array(
     234        $comment_one = self::factory()->activity->create( array(
    235235            'type'              => 'activity_comment',
    236236            'item_id'           => $parent_activity,
     
    238238        ) );
    239239
    240         $comment_two = $this->factory->activity->create( array(
     240        $comment_two = self::factory()->activity->create( array(
    241241            'type'              => 'activity_comment',
    242242            'item_id'           => $parent_activity,
     
    271271     */
    272272    public function test_bp_activity_update_meta_with_line_breaks() {
    273         $a = $this->factory->activity->create();
     273        $a = self::factory()->activity->create();
    274274        $meta_value = 'Foo!
    275275
     
    285285     */
    286286    public function test_bp_activity_update_meta_with_0() {
    287         $a = $this->factory->activity->create();
     287        $a = self::factory()->activity->create();
    288288        $meta_value = 0;
    289289
     
    307307     */
    308308    public function test_bp_activity_update_meta_with_illegal_key_characters() {
    309         $a = $this->factory->activity->create();
     309        $a = self::factory()->activity->create();
    310310        $krazy_key = ' f!@#$%^o *(){}o?+';
    311311        bp_activity_update_meta( $a, $krazy_key, 'bar' );
     
    319319     */
    320320    public function test_bp_activity_update_meta_stripslashes() {
    321         $a = $this->factory->activity->create();
     321        $a = self::factory()->activity->create();
    322322        $value = "This string is totally slashin\'!";
    323323        bp_activity_update_meta( $a, 'foo', $value );
     
    331331     */
    332332    public function test_bp_activity_update_meta_false_value_deletes() {
    333         $a = $this->factory->activity->create();
     333        $a = self::factory()->activity->create();
    334334        bp_activity_update_meta( $a, 'foo', false );
    335335        $this->assertSame( '', bp_activity_get_meta( $a, 'foo' ) );
     
    341341     */
    342342    public function test_bp_activity_update_meta_new() {
    343         $a = $this->factory->activity->create();
     343        $a = self::factory()->activity->create();
    344344        $this->assertSame( '', bp_activity_get_meta( $a, 'foo' ), '"foo" meta should be empty for this activity item.' );
    345345        $this->assertNotEmpty( bp_activity_update_meta( $a, 'foo', 'bar' ) );
     
    352352     */
    353353    public function test_bp_activity_update_meta_existing() {
    354         $a = $this->factory->activity->create();
     354        $a = self::factory()->activity->create();
    355355        bp_activity_update_meta( $a, 'foo', 'bar' );
    356356        $this->assertSame( 'bar', bp_activity_get_meta( $a, 'foo' ) );
     
    364364     */
    365365    public function test_bp_activity_update_meta_same_value() {
    366         $a = $this->factory->activity->create();
     366        $a = self::factory()->activity->create();
    367367        bp_activity_update_meta( $a, 'foo', 'bar' );
    368368        $this->assertSame( 'bar', bp_activity_get_meta( $a, 'foo' ) );
     
    376376     */
    377377    public function test_bp_activity_update_meta_prev_value() {
    378         $a = $this->factory->activity->create();
     378        $a = self::factory()->activity->create();
    379379        bp_activity_add_meta( $a, 'foo', 'bar' );
    380380
     
    413413     */
    414414    public function test_bp_activity_get_meta_with_illegal_characters() {
    415         $a = $this->factory->activity->create();
     415        $a = self::factory()->activity->create();
    416416        bp_activity_update_meta( $a, 'foo', 'bar' );
    417417
     
    425425     */
    426426    public function test_bp_activity_get_meta_multiple() {
    427         $a = $this->factory->activity->create();
     427        $a = self::factory()->activity->create();
    428428        bp_activity_update_meta( $a, 'foo', 'bar' );
    429429        bp_activity_update_meta( $a, 'foo1', 'bar1' );
     
    447447     */
    448448    public function test_bp_activity_get_meta_no_results_returns_false() {
    449         $a = $this->factory->activity->create();
     449        $a = self::factory()->activity->create();
    450450
    451451        $this->assertSame( '', bp_activity_get_meta( $a, 'foo' ) );
     
    457457     */
    458458    public function test_bp_activity_get_meta_single_true() {
    459         $a = $this->factory->activity->create();
     459        $a = self::factory()->activity->create();
    460460        bp_activity_add_meta( $a, 'foo', 'bar' );
    461461        bp_activity_add_meta( $a, 'foo', 'baz' );
     
    469469     */
    470470    public function test_bp_activity_get_meta_single_false() {
    471         $a = $this->factory->activity->create();
     471        $a = self::factory()->activity->create();
    472472        bp_activity_add_meta( $a, 'foo', 'bar' );
    473473        bp_activity_add_meta( $a, 'foo', 'baz' );
     
    481481     */
    482482    public function test_bp_activity_get_meta_cache_all_on_get() {
    483         $a = $this->factory->activity->create();
     483        $a = self::factory()->activity->create();
    484484        bp_activity_add_meta( $a, 'foo', 'bar' );
    485485        bp_activity_add_meta( $a, 'foo1', 'baz' );
     
    507507     */
    508508    public function test_bp_activity_delete_meta_trim_meta_value() {
    509         $a = $this->factory->activity->create();
     509        $a = self::factory()->activity->create();
    510510        bp_activity_update_meta( $a, 'foo', 'bar' );
    511511        bp_activity_delete_meta( $a, 'foo', ' bar ' );
     
    518518     */
    519519    public function test_bp_activity_delete_meta_single() {
    520         $a = $this->factory->activity->create();
     520        $a = self::factory()->activity->create();
    521521        bp_activity_update_meta( $a, 'foo', 'bar' );
    522522        $this->assertTrue( bp_activity_delete_meta( $a, 'foo', 'bar' ) );
     
    529529     */
    530530    public function test_bp_activity_delete_meta_all_for_activity() {
    531         $a = $this->factory->activity->create();
     531        $a = self::factory()->activity->create();
    532532        bp_activity_update_meta( $a, 'foo', 'bar' );
    533533        bp_activity_update_meta( $a, 'foo1', 'bar1' );
     
    542542     */
    543543    public function test_bp_activity_delete_meta_with_meta_value() {
    544         $a = $this->factory->activity->create();
     544        $a = self::factory()->activity->create();
    545545        bp_activity_update_meta( $a, 'foo', 'bar' );
    546546        $this->assertTrue( bp_activity_delete_meta( $a, 'foo', 'bar' ) );
     
    555555        // With no meta key, don't delete for all items - just delete
    556556        // all for a single item
    557         $a1 = $this->factory->activity->create();
    558         $a2 = $this->factory->activity->create();
     557        $a1 = self::factory()->activity->create();
     558        $a2 = self::factory()->activity->create();
    559559        bp_activity_update_meta( $a1, 'foo', 'bar' );
    560560        bp_activity_update_meta( $a1, 'foo1', 'bar1' );
     
    575575        // With no meta key, don't delete for all items - just delete
    576576        // all for a single item
    577         $a1 = $this->factory->activity->create();
    578         $a2 = $this->factory->activity->create();
     577        $a1 = self::factory()->activity->create();
     578        $a2 = self::factory()->activity->create();
    579579        bp_activity_update_meta( $a1, 'foo', 'bar' );
    580580        bp_activity_update_meta( $a1, 'foo1', 'bar1' );
     
    610610     */
    611611    public function test_bp_activity_add_meta_existing_unique() {
    612         $a = $this->factory->activity->create();
     612        $a = self::factory()->activity->create();
    613613        bp_activity_add_meta( $a, 'foo', 'bar' );
    614614        $this->assertFalse( bp_activity_add_meta( $a, 'foo', 'baz', true ) );
     
    620620     */
    621621    public function test_bp_activity_add_meta_existing_not_unique() {
    622         $a = $this->factory->activity->create();
     622        $a = self::factory()->activity->create();
    623623        bp_activity_add_meta( $a, 'foo', 'bar' );
    624624        $this->assertNotEmpty( bp_activity_add_meta( $a, 'foo', 'baz' ) );
     
    631631        add_filter( 'bp_is_username_compatibility_mode', '__return_false' );
    632632
    633         $u = $this->factory->user->create( array(
     633        $u = self::factory()->user->create( array(
    634634            'user_login' => 'foo bar baz',
    635635            'user_nicename' => 'foo-bar-baz',
     
    647647        add_filter( 'bp_is_username_compatibility_mode', '__return_true' );
    648648
    649         $u1 = $this->factory->user->create( array(
     649        $u1 = self::factory()->user->create( array(
    650650            'user_login' => 'foo bar baz',
    651651            'user_nicename' => 'foo-bar-baz',
    652652        ) );
    653653
    654         $u2 = $this->factory->user->create( array(
     654        $u2 = self::factory()->user->create( array(
    655655            'user_login' => 'foo.bar.baz',
    656656            'user_nicename' => 'foo-bar-baz',
     
    669669        add_filter( 'bp_is_username_compatibility_mode', '__return_false' );
    670670
    671         $u = $this->factory->user->create( array(
     671        $u = self::factory()->user->create( array(
    672672            'user_login' => 'foo bar baz',
    673673            'user_nicename' => 'foo-bar-baz',
     
    686686
    687687        // all spaces are hyphens
    688         $u1 = $this->factory->user->create( array(
     688        $u1 = self::factory()->user->create( array(
    689689            'user_login' => 'foo bar baz',
    690690            'user_nicename' => 'foobarbaz',
     
    692692
    693693        // no spaces are hyphens
    694         $u2 = $this->factory->user->create( array(
     694        $u2 = self::factory()->user->create( array(
    695695            'user_login' => 'foo-bar-baz-1',
    696696            'user_nicename' => 'foobarbaz-1',
     
    698698
    699699        // some spaces are hyphens
    700         $u3 = $this->factory->user->create( array(
     700        $u3 = self::factory()->user->create( array(
    701701            'user_login' => 'foo bar-baz 2',
    702702            'user_nicename' => 'foobarbaz-2',
    703703        ) );
    704704
    705         $u4 = $this->factory->user->create( array(
     705        $u4 = self::factory()->user->create( array(
    706706            'user_login' => 'foo.bar.baz',
    707707            'user_nicename' => 'foo-bar-baz',
     
    721721     */
    722722    public function test_bp_activity_format_activity_action_activity_update() {
    723         $u = $this->factory->user->create();
    724         $a = $this->factory->activity->create( array(
     723        $u = self::factory()->user->create();
     724        $a = self::factory()->activity->create( array(
    725725            'component' => buddypress()->activity->id,
    726726            'type' => 'activity_update',
     
    740740     */
    741741    public function test_bp_activity_format_activity_action_activity_comment() {
    742         $u = $this->factory->user->create();
    743         $a = $this->factory->activity->create( array(
     742        $u = self::factory()->user->create();
     743        $a = self::factory()->activity->create( array(
    744744            'component' => buddypress()->activity->id,
    745745            'type' => 'activity_comment',
     
    773773        bp_activity_get_actions();
    774774
    775         $u = $this->factory->user->create();
    776         $p = $this->factory->post->create( array(
     775        $u = self::factory()->user->create();
     776        $p = self::factory()->post->create( array(
    777777            'post_author' => $u,
    778778            'post_type'   => 'foo',
    779779        ) );
    780780
    781         $a = $this->factory->activity->create( array(
     781        $a = self::factory()->activity->create( array(
    782782            'component'         => 'activity',
    783783            'type'              => 'new_foo',
     
    811811        }
    812812
    813         $b = $this->factory->blog->create();
    814         $u = $this->factory->user->create();
     813        $b = self::factory()->blog->create();
     814        $u = self::factory()->user->create();
    815815
    816816        switch_to_blog( $b );
     
    825825        bp_activity_get_actions();
    826826
    827         $p = $this->factory->post->create( array(
     827        $p = self::factory()->post->create( array(
    828828            'post_author' => $u,
    829829            'post_type'   => 'foo',
     
    843843        restore_current_blog();
    844844
    845         $a = $this->factory->activity->create( $activity_args );
     845        $a = self::factory()->activity->create( $activity_args );
    846846
    847847        $a_obj = new BP_Activity_Activity( $a );
     
    886886        bp_activity_get_actions();
    887887
    888         $u = $this->factory->user->create();
    889         $p = $this->factory->post->create( array(
     888        $u = self::factory()->user->create();
     889        $p = self::factory()->post->create( array(
    890890            'post_author' => $u,
    891891            'post_type'   => 'foo',
    892892        ) );
    893893
    894         $a = $this->factory->activity->create( array(
     894        $a = self::factory()->activity->create( array(
    895895            'component'         => 'activity',
    896896            'type'              => 'foo_bar',
     
    923923        }
    924924
    925         $b = $this->factory->blog->create();
    926         $u = $this->factory->user->create();
     925        $b = self::factory()->blog->create();
     926        $u = self::factory()->user->create();
    927927
    928928        switch_to_blog( $b );
     
    943943        bp_activity_get_actions();
    944944
    945         $p = $this->factory->post->create( array(
     945        $p = self::factory()->post->create( array(
    946946            'post_author' => $u,
    947947            'post_type'   => 'foo',
     
    960960        restore_current_blog();
    961961
    962         $a = $this->factory->activity->create( $activity_args );
     962        $a = self::factory()->activity->create( $activity_args );
    963963
    964964        $a_obj = new BP_Activity_Activity( $a );
     
    990990        bp_activity_get_actions();
    991991
    992         $u = $this->factory->user->create();
    993 
    994         $post_id = $this->factory->post->create( array(
     992        $u = self::factory()->user->create();
     993
     994        $post_id = self::factory()->post->create( array(
    995995            'post_author' => $u,
    996996            'post_status' => 'publish',
     
    10541054    public function test_bp_activity_format_activity_action_custom_post_type_comment() {
    10551055        if ( is_multisite() ) {
    1056             $b = $this->factory->blog->create();
     1056            $b = self::factory()->blog->create();
    10571057            switch_to_blog( $b );
    10581058            add_filter( 'comment_flood_filter', '__return_false' );
     
    10611061        }
    10621062
    1063         $u = $this->factory->user->create();
     1063        $u = self::factory()->user->create();
    10641064        $userdata = get_userdata( $u );
    10651065
     
    10841084        bp_activity_get_actions();
    10851085
    1086         $p = $this->factory->post->create( array(
     1086        $p = self::factory()->post->create( array(
    10871087            'post_author' => $u,
    10881088            'post_type'   => 'foo',
     
    11271127     */
    11281128    public function test_bp_activity_new_comment_clear_comment_caches() {
    1129         $u = $this->factory->user->create();
    1130         $a1 = $this->factory->activity->create( array(
     1129        $u = self::factory()->user->create();
     1130        $a1 = self::factory()->activity->create( array(
    11311131            'user_id' => $u,
    11321132        ) );
     
    11811181     */
    11821182    public function test_bp_activity_new_comment_clear_activity_caches() {
    1183         $u = $this->factory->user->create();
    1184         $a1 = $this->factory->activity->create( array(
     1183        $u = self::factory()->user->create();
     1184        $a1 = self::factory()->activity->create( array(
    11851185            'user_id' => $u,
    11861186        ) );
     
    12531253     */
    12541254    public function test_bp_activity_delete_comment_clear_cache() {
    1255         $u = $this->factory->user->create();
     1255        $u = self::factory()->user->create();
    12561256        // add new activity update and comment to this update
    1257         $a1 = $this->factory->activity->create( array(
     1257        $a1 = self::factory()->activity->create( array(
    12581258            'user_id' => $u,
    12591259        ) );
     
    12831283     */
    12841284    public function test_bp_activity_delete_comment_shouldnt_delete_all_comments_when_parameters_are_empty() {
    1285         $u = $this->factory->user->create();
     1285        $u = self::factory()->user->create();
    12861286
    12871287        // create an activity update
    1288         $parent_activity = $this->factory->activity->create( array(
     1288        $parent_activity = self::factory()->activity->create( array(
    12891289            'type'    => 'activity_update',
    12901290            'user_id' => $u
     
    13301330     */
    13311331    public function test_bp_activity_comment_on_deleted_activity() {
    1332         $u = $this->factory->user->create();
    1333         $a = $this->factory->activity->create();
     1332        $u = self::factory()->user->create();
     1333        $a = self::factory()->activity->create();
    13341334
    13351335        bp_activity_delete_by_activity_id( $a );
     
    13501350     */
    13511351    public function test_add_user_favorite_already_favorited() {
    1352         $u = $this->factory->user->create();
    1353         $a = $this->factory->activity->create();
     1352        $u = self::factory()->user->create();
     1353        $a = self::factory()->activity->create();
    13541354
    13551355        // bp_activity_add_user_favorite() requires a logged-in user.
     
    13711371     */
    13721372    public function test_add_user_favorite_not_yet_favorited() {
    1373         $u = $this->factory->user->create();
    1374         $a = $this->factory->activity->create();
     1373        $u = self::factory()->user->create();
     1374        $a = self::factory()->activity->create();
    13751375
    13761376        // bp_activity_add_user_favorite() requires a logged-in user.
     
    13871387     */
    13881388    public function test_remove_user_favorite_bad_activity_id() {
    1389         $u1 = $this->factory->user->create();
    1390         $u2 = $this->factory->user->create();
    1391         $a = $this->factory->activity->create();
     1389        $u1 = self::factory()->user->create();
     1390        $u2 = self::factory()->user->create();
     1391        $a = self::factory()->activity->create();
    13921392
    13931393        // bp_activity_add_user_favorite() requires a logged-in user.
     
    14261426     */
    14271427    public function test_bp_activity_post_update_success() {
    1428         $u = $this->factory->user->create();
     1428        $u = self::factory()->user->create();
    14291429
    14301430        $a = bp_activity_post_update( array(
     
    14481448        );
    14491449
    1450         $a = $this->factory->activity->create( $args );
     1450        $a = self::factory()->activity->create( $args );
    14511451
    14521452        $this->assertEquals( $a, bp_activity_get_activity_id( $args ) );
     
    14651465        );
    14661466
    1467         $a = $this->factory->activity->create( $args );
     1467        $a = self::factory()->activity->create( $args );
    14681468
    14691469        $this->assertTrue( bp_activity_delete_by_item_id( $args ) );
  • trunk/tests/phpunit/testcases/activity/functions/bpActivityGetCommentDepth.php

    r11413 r11737  
    1010     */
    1111    public function test_depth_inside_activity_comment_loop() {
    12         $u = $this->factory->user->create();
     12        $u = self::factory()->user->create();
    1313
    1414        // create an activity update
    15         $parent_activity = $this->factory->activity->create( array(
     15        $parent_activity = self::factory()->activity->create( array(
    1616            'type'    => 'activity_update',
    1717            'user_id' => $u
     
    7777     */
    7878    public function test_depth_outside_of_activity_comment_loop() {
    79         $u = $this->factory->user->create();
     79        $u = self::factory()->user->create();
    8080
    8181        // create an activity update
    82         $parent_activity = $this->factory->activity->create( array(
     82        $parent_activity = self::factory()->activity->create( array(
    8383            'type'    => 'activity_update',
    8484            'user_id' => $u
  • trunk/tests/phpunit/testcases/activity/notifications.php

    r11256 r11737  
    1515        parent::setUp();
    1616        $this->current_user = get_current_user_id();
    17         $this->u1 = $this->factory->user->create();
    18         $this->u2 = $this->factory->user->create();
     17        $this->u1 = self::factory()->user->create();
     18        $this->u2 = self::factory()->user->create();
    1919        $this->set_current_user( $this->u1 );
    2020
     
    274274    protected function create_notifications() {
    275275        $u1_mentionname = bp_activity_get_user_mentionname( $this->u1 );
    276         $this->a1 = $this->factory->activity->create( array(
     276        $this->a1 = self::factory()->activity->create( array(
    277277            'user_id' => $this->u2,
    278278            'component' => buddypress()->activity->id,
     
    281281        ) );
    282282        $u2_mentionname = bp_activity_get_user_mentionname( $this->u2 );
    283         $this->a2 = $this->factory->activity->create( array(
     283        $this->a2 = self::factory()->activity->create( array(
    284284            'user_id' => $this->u1,
    285285            'component' => buddypress()->activity->id,
     
    296296
    297297        // Current user is $this->u1, so $this->u2 posted the mention
    298         $a = $this->factory->activity->create( array(
     298        $a = self::factory()->activity->create( array(
    299299            'user_id' => $this->u2,
    300300            'component' => buddypress()->activity->id,
     
    338338     */
    339339    public function test_bp_activity_comment_add_notification() {
    340         $a = $this->factory->activity->create( array(
     340        $a = self::factory()->activity->create( array(
    341341            'user_id' => $this->u1,
    342342            'component' => buddypress()->activity->id,
     
    352352        ) );
    353353
    354         $u3 = $this->factory->user->create();
     354        $u3 = self::factory()->user->create();
    355355
    356356        $r3 = bp_activity_new_comment( array(
     
    381381    public function test_activity_reply_notifications_for_blog_comment_to_activity_comment_sync() {
    382382        $old_user = get_current_user_id();
    383         $u1 = $this->factory->user->create();
    384         $u2 = $this->factory->user->create();
    385         $u3 = $this->factory->user->create();
     383        $u1 = self::factory()->user->create();
     384        $u2 = self::factory()->user->create();
     385        $u3 = self::factory()->user->create();
    386386
    387387        $this->set_current_user( $u1 );
     
    395395
    396396        // create the blog post
    397         $post_id = $this->factory->post->create( array(
     397        $post_id = self::factory()->post->create( array(
    398398            'post_status' => 'publish',
    399399            'post_type'   => 'post',
     
    415415        ) );
    416416        // Approve the comment
    417         $this->factory->comment->update_object( $c1, array( 'comment_approved' => 1 ) );
     417        self::factory()->comment->update_object( $c1, array( 'comment_approved' => 1 ) );
    418418
    419419        $this->set_current_user( $u3 );
     
    431431        ) );
    432432        // Approve the comment
    433         $this->factory->comment->update_object( $c2, array( 'comment_approved' => 1 ) );
     433        self::factory()->comment->update_object( $c2, array( 'comment_approved' => 1 ) );
    434434
    435435        // Get activity IDs.
  • trunk/tests/phpunit/testcases/activity/template.php

    r11091 r11737  
    1010    public function test_user_can_delete() {
    1111        $bp = buddypress();
    12         $u = $this->factory->user->create();
     12        $u = self::factory()->user->create();
    1313        $original_user = bp_loggedin_user_id();
    1414        $this->set_current_user( $u );
    1515
    16         $a = $this->factory->activity->create( array(
     16        $a = self::factory()->activity->create( array(
    1717            'type' => 'activity_update',
    1818            'user_id' => $u,
     
    2020
    2121        // User can delete his own items
    22         $activity = $this->factory->activity->get_object_by_id( $a );
     22        $activity = self::factory()->activity->get_object_by_id( $a );
    2323        $this->assertTrue( bp_activity_user_can_delete( $activity ) );
    2424
     
    2828
    2929        // Miscellaneous user can't delete
    30         $misc_user = $this->factory->user->create( array( 'role' => 'subscriber' ) );
     30        $misc_user = self::factory()->user->create( array( 'role' => 'subscriber' ) );
    3131        $this->set_current_user( $misc_user );
    3232        $this->assertFalse( bp_activity_user_can_delete( $activity ) );
     
    5252        // save the current user and override logged-in user
    5353        $old_user = get_current_user_id();
    54         $u = $this->factory->user->create();
     54        $u = self::factory()->user->create();
    5555        $this->set_current_user( $u );
    5656
    5757        // create an activity update for the user
    58         $this->factory->activity->create( array(
     58        self::factory()->activity->create( array(
    5959            'component' => buddypress()->activity->id,
    6060            'type' => 'activity_update',
     
    8181     */
    8282    public function test_bp_has_activities_favorites_action_filter() {
    83         $user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
    84 
    85         $now = time();
    86 
    87         $a1 = $this->factory->activity->create( array(
     83        $user_id = self::factory()->user->create( array( 'role' => 'subscriber' ) );
     84
     85        $now = time();
     86
     87        $a1 = self::factory()->activity->create( array(
    8888            'type' => 'activity_update',
    8989            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    9090        ) );
    9191
    92         $a2 = $this->factory->activity->create( array(
     92        $a2 = self::factory()->activity->create( array(
    9393            'type' => 'joined_group',
    9494            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
     
    141141     */
    142142    function test_bp_has_activities_just_me_scope_with_no_user_id() {
    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
    146146        // save the current user and override logged-in user
     
    151151
    152152        // activity item
    153         $a1 = $this->factory->activity->create( array(
     153        $a1 = self::factory()->activity->create( array(
    154154            'user_id'   => $u1,
    155155            'component' => 'activity',
     
    160160        // misc activity items
    161161
    162         $this->factory->activity->create( array(
     162        self::factory()->activity->create( array(
    163163            'user_id'   => $u2,
    164164            'component' => 'activity',
     
    166166            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    167167        ) );
    168         $this->factory->activity->create( array(
     168        self::factory()->activity->create( array(
    169169            'user_id'   => $u2,
    170170            'component' => 'groups',
     
    197197     */
    198198    function test_bp_has_activities_mentions_scope() {
    199         $u1 = $this->factory->user->create();
    200         $u2 = $this->factory->user->create();
     199        $u1 = self::factory()->user->create();
     200        $u2 = self::factory()->user->create();
    201201
    202202        $now = time();
     
    204204        // mentioned activity item
    205205        $mention_username = '@' . bp_activity_get_user_mentionname( $u1 );
    206         $a1 = $this->factory->activity->create( array(
     206        $a1 = self::factory()->activity->create( array(
    207207            'user_id' => $u2,
    208208            'type'    => 'activity_update',
     
    212212
    213213        // misc activity items
    214         $this->factory->activity->create( array(
     214        self::factory()->activity->create( array(
    215215            'user_id'   => $u1,
    216216            'component' => 'blogs',
     
    219219            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    220220        ) );
    221         $this->factory->activity->create( array(
     221        self::factory()->activity->create( array(
    222222            'user_id'   => $u2,
    223223            'component' => 'activity',
     
    225225            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    226226        ) );
    227         $this->factory->activity->create( array(
     227        self::factory()->activity->create( array(
    228228            'user_id'   => $u2,
    229229            'component' => 'groups',
     
    254254     */
    255255    function test_bp_has_activities_friends_and_mentions_scope() {
    256         $u1 = $this->factory->user->create();
    257         $u2 = $this->factory->user->create();
    258         $u3 = $this->factory->user->create();
     256        $u1 = self::factory()->user->create();
     257        $u2 = self::factory()->user->create();
     258        $u3 = self::factory()->user->create();
    259259
    260260        // user 1 becomes friends with user 2
     
    264264
    265265        // friend status update
    266         $a1 = $this->factory->activity->create( array(
     266        $a1 = self::factory()->activity->create( array(
    267267            'user_id' => $u2,
    268268            'type' => 'activity_update',
     
    272272        // mentioned item by non-friend
    273273        $mention_username = '@' . bp_activity_get_user_mentionname( $u1 );
    274         $a2 = $this->factory->activity->create( array(
     274        $a2 = self::factory()->activity->create( array(
    275275            'user_id'   => $u3,
    276276            'component' => 'activity',
     
    281281
    282282        // misc activity items
    283         $this->factory->activity->create( array(
     283        self::factory()->activity->create( array(
    284284            'user_id'   => $u1,
    285285            'component' => 'blogs',
     
    288288            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    289289        ) );
    290         $this->factory->activity->create( array(
     290        self::factory()->activity->create( array(
    291291            'user_id'   => $u3,
    292292            'component' => 'activity',
     
    294294            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    295295        ) );
    296         $this->factory->activity->create( array(
     296        self::factory()->activity->create( array(
    297297            'user_id'   => $u3,
    298298            'component' => 'groups',
     
    323323     */
    324324    function test_bp_has_activities_groups_and_friends_scope() {
    325         $u1 = $this->factory->user->create();
    326         $u2 = $this->factory->user->create();
    327         $u3 = $this->factory->user->create();
     325        $u1 = self::factory()->user->create();
     326        $u2 = self::factory()->user->create();
     327        $u3 = self::factory()->user->create();
    328328
    329329        // user 1 becomes friends with user 2
     
    331331
    332332        // user 1 joins a group
    333         $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    334         $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
     333        $g1 = self::factory()->group->create( array( 'creator_id' => $u1 ) );
     334        $g2 = self::factory()->group->create( array( 'creator_id' => $u1 ) );
    335335
    336336        $now = time();
    337337
    338338        // friend status update
    339         $a1 = $this->factory->activity->create( array(
     339        $a1 = self::factory()->activity->create( array(
    340340            'user_id' => $u2,
    341341            'type' => 'activity_update',
     
    344344
    345345        // group activity
    346         $a2 = $this->factory->activity->create( array(
     346        $a2 = self::factory()->activity->create( array(
    347347            'user_id'   => $u3,
    348348            'component' => 'groups',
     
    353353
    354354        // misc activity items
    355         $this->factory->activity->create( array(
     355        self::factory()->activity->create( array(
    356356            'user_id'   => $u3,
    357357            'component' => 'blogs',
     
    360360            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    361361        ) );
    362         $this->factory->activity->create( array(
     362        self::factory()->activity->create( array(
    363363            'user_id'   => $u3,
    364364            'component' => 'activity',
     
    370370        global $wpdb, $bp;
    371371        $max_group_id = $wpdb->get_var( "SELECT id FROM {$bp->groups->table_name} ORDER BY id DESC LIMIT 1" );
    372         $this->factory->activity->create( array(
     372        self::factory()->activity->create( array(
    373373            'user_id'   => $u3,
    374374            'component' => 'groups',
     
    399399     */
    400400    function test_bp_has_activities_scope_friends_no_items() {
    401         $u1 = $this->factory->user->create();
     401        $u1 = self::factory()->user->create();
    402402
    403403        $now = time();
    404404
    405405        // Create a random activity
    406         $this->factory->activity->create( array(
     406        self::factory()->activity->create( array(
    407407            'user_id' => $u1,
    408408            'type' => 'activity_update',
     
    432432     */
    433433    function test_bp_has_activities_scope_favorites_no_items() {
    434         $u1 = $this->factory->user->create();
     434        $u1 = self::factory()->user->create();
    435435
    436436        $now = time();
    437437
    438438        // Create a random activity
    439         $this->factory->activity->create( array(
     439        self::factory()->activity->create( array(
    440440            'user_id' => $u1,
    441441            'type' => 'activity_update',
     
    465465     */
    466466    function test_bp_has_activities_scope_groups_no_items() {
    467         $u1 = $this->factory->user->create();
     467        $u1 = self::factory()->user->create();
    468468
    469469        $now = time();
    470470
    471471        // Create a random activity
    472         $this->factory->activity->create( array(
     472        self::factory()->activity->create( array(
    473473            'user_id' => $u1,
    474474            'type' => 'activity_update',
     
    498498     */
    499499    function test_bp_has_activities_scope_mentions_no_items() {
    500         $u1 = $this->factory->user->create();
     500        $u1 = self::factory()->user->create();
    501501
    502502        $now = time();
    503503
    504504        // Create a random activity
    505         $this->factory->activity->create( array(
     505        self::factory()->activity->create( array(
    506506            'user_id' => $u1,
    507507            'type' => 'activity_update',
     
    530530     */
    531531    public function test_bp_has_activities_scope_friends_should_respect_id_order_when_record_dates_are_same() {
    532         $u1 = $this->factory->user->create();
    533         $u2 = $this->factory->user->create();
     532        $u1 = self::factory()->user->create();
     533        $u2 = self::factory()->user->create();
    534534
    535535        friends_add_friend( $u1, $u2, true );
    536536
    537537        // Friend's very fast status updates.
    538         $a1 = $this->factory->activity->create( array(
     538        $a1 = self::factory()->activity->create( array(
    539539            'user_id' => $u2,
    540540            'type' => 'activity_update',
    541541            'recorded_time' => date( 'Y-m-d H:i:s', 1451944920 ),
    542542        ) );
    543         $a2 = $this->factory->activity->create( array(
     543        $a2 = self::factory()->activity->create( array(
    544544            'user_id' => $u2,
    545545            'type' => 'activity_update',
     
    569569     */
    570570    public function test_bp_has_activities_scope_groups_should_respect_id_order_when_record_dates_are_same() {
    571         $u1 = $this->factory->user->create();
    572         $u2 = $this->factory->user->create();
    573         $u3 = $this->factory->user->create();
    574 
    575         $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
     571        $u1 = self::factory()->user->create();
     572        $u2 = self::factory()->user->create();
     573        $u3 = self::factory()->user->create();
     574
     575        $g1 = self::factory()->group->create( array( 'creator_id' => $u1 ) );
    576576
    577577        // Two user join first user's group same time
    578         $a1 = $this->factory->activity->create( array(
     578        $a1 = self::factory()->activity->create( array(
    579579            'user_id'   => $u2,
    580580            'component' => 'groups',
     
    583583            'recorded_time' => date( 'Y-m-d H:i:s', 1451944920 ),
    584584        ) );
    585         $a2 = $this->factory->activity->create( array(
     585        $a2 = self::factory()->activity->create( array(
    586586            'user_id'   => $u3,
    587587            'component' => 'groups',
     
    613613     */
    614614    function test_bp_has_activities_with_filter_query_nested_conditions() {
    615         $u1 = $this->factory->user->create();
    616         $u2 = $this->factory->user->create();
    617         $u3 = $this->factory->user->create();
    618 
    619         $now = time();
    620 
    621         $a1 = $this->factory->activity->create( array(
     615        $u1 = self::factory()->user->create();
     616        $u2 = self::factory()->user->create();
     617        $u3 = self::factory()->user->create();
     618
     619        $now = time();
     620
     621        $a1 = self::factory()->activity->create( array(
    622622            'user_id'   => $u3,
    623623            'component' => 'blogs',
     
    626626            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    627627        ) );
    628         $a2 = $this->factory->activity->create( array(
     628        $a2 = self::factory()->activity->create( array(
    629629            'user_id'   => $u2,
    630630            'component' => 'activity',
     
    634634
    635635        // misc activity items
    636         $this->factory->activity->create( array(
     636        self::factory()->activity->create( array(
    637637            'user_id'   => $u3,
    638638            'component' => 'activity',
     
    640640            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    641641        ) );
    642         $this->factory->activity->create( array(
     642        self::factory()->activity->create( array(
    643643            'user_id'   => $u3,
    644644            'component' => 'groups',
     
    683683     */
    684684    function test_bp_has_activities_with_filter_query_compare_not_in_operator() {
    685         $u1 = $this->factory->user->create();
    686         $u2 = $this->factory->user->create();
    687         $u3 = $this->factory->user->create();
     685        $u1 = self::factory()->user->create();
     686        $u2 = self::factory()->user->create();
     687        $u3 = self::factory()->user->create();
    688688
    689689        $now = time();
    690690
    691691        // misc activity items
    692         $a1 = $this->factory->activity->create( array(
     692        $a1 = self::factory()->activity->create( array(
    693693            'user_id'   => $u3,
    694694            'component' => 'blogs',
     
    697697            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    698698        ) );
    699         $a2 = $this->factory->activity->create( array(
     699        $a2 = self::factory()->activity->create( array(
    700700            'user_id'   => $u2,
    701701            'component' => 'activity',
     
    703703            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    704704        ) );
    705         $a3 = $this->factory->activity->create( array(
     705        $a3 = self::factory()->activity->create( array(
    706706            'user_id'   => $u3,
    707707            'component' => 'activity',
     
    709709            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    710710        ) );
    711         $a4 = $this->factory->activity->create( array(
     711        $a4 = self::factory()->activity->create( array(
    712712            'user_id'   => $u3,
    713713            'component' => 'groups',
     
    741741     */
    742742    function test_bp_has_activities_with_filter_query_compare_between_operator() {
    743         $u1 = $this->factory->user->create();
     743        $u1 = self::factory()->user->create();
    744744
    745745        $now = time();
    746746
    747747        // misc activity items
    748         $a1 = $this->factory->activity->create( array(
     748        $a1 = self::factory()->activity->create( array(
    749749            'user_id'   => $u1,
    750750            'component' => 'blogs',
     
    753753            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    754754        ) );
    755         $a2 = $this->factory->activity->create( array(
     755        $a2 = self::factory()->activity->create( array(
    756756            'user_id'   => $u1,
    757757            'component' => 'activity',
     
    759759            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    760760        ) );
    761         $a3 = $this->factory->activity->create( array(
     761        $a3 = self::factory()->activity->create( array(
    762762            'user_id'   => $u1,
    763763            'component' => 'activity',
     
    765765            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    766766        ) );
    767         $a4 = $this->factory->activity->create( array(
     767        $a4 = self::factory()->activity->create( array(
    768768            'user_id'   => $u1,
    769769            'component' => 'groups',
     
    797797     */
    798798    function test_bp_has_activities_with_filter_query_compare_arithmetic_comparisons() {
    799         $u1 = $this->factory->user->create();
     799        $u1 = self::factory()->user->create();
    800800
    801801        $now = time();
    802802
    803803        // misc activity items
    804         $a1 = $this->factory->activity->create( array(
     804        $a1 = self::factory()->activity->create( array(
    805805            'user_id'   => $u1,
    806806            'component' => 'activity',
     
    809809            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    810810        ) );
    811         $a2 = $this->factory->activity->create( array(
     811        $a2 = self::factory()->activity->create( array(
    812812            'user_id'   => $u1,
    813813            'component' => 'activity',
     
    816816            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    817817        ) );
    818         $a3 = $this->factory->activity->create( array(
     818        $a3 = self::factory()->activity->create( array(
    819819            'user_id'   => $u1,
    820820            'component' => 'activity',
     
    823823            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    824824        ) );
    825         $a4 = $this->factory->activity->create( array(
     825        $a4 = self::factory()->activity->create( array(
    826826            'user_id'   => $u1,
    827827            'component' => 'activity',
     
    913913     */
    914914    function test_bp_has_activities_with_filter_query_compare_regex() {
    915         $u1 = $this->factory->user->create();
     915        $u1 = self::factory()->user->create();
    916916
    917917        $now = time();
    918918
    919919        // misc activity items
    920         $a1 = $this->factory->activity->create( array(
     920        $a1 = self::factory()->activity->create( array(
    921921            'user_id'   => $u1,
    922922            'component' => 'blogs',
     
    925925            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    926926        ) );
    927         $a2 = $this->factory->activity->create( array(
     927        $a2 = self::factory()->activity->create( array(
    928928            'user_id'   => $u1,
    929929            'component' => 'blogs',
     
    931931            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    932932        ) );
    933         $a3 = $this->factory->activity->create( array(
     933        $a3 = self::factory()->activity->create( array(
    934934            'user_id'   => $u1,
    935935            'component' => 'activity',
     
    937937            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
    938938        ) );
    939         $a4 = $this->factory->activity->create( array(
     939        $a4 = self::factory()->activity->create( array(
    940940            'user_id'   => $u1,
    941941            'component' => 'groups',
     
    10031003        $reset_current_action = $bp->current_action;
    10041004
    1005         $u1 = $this->factory->user->create();
    1006         $u2 = $this->factory->user->create();
    1007         $u3 = $this->factory->user->create();
     1005        $u1 = self::factory()->user->create();
     1006        $u2 = self::factory()->user->create();
     1007        $u3 = self::factory()->user->create();
    10081008
    10091009        $this->set_current_user( $u1 );
    10101010
    1011         $g = $this->factory->group->create( array(
     1011        $g = self::factory()->group->create( array(
    10121012            'status' => 'private',
    10131013        ) );
     
    10161016        groups_join_group( $g, $u3 );
    10171017
    1018         $a1 = $this->factory->activity->create( array(
     1018        $a1 = self::factory()->activity->create( array(
    10191019            'component' => $bp->groups->id,
    10201020            'item_id'   => $g,
     
    10241024        ) );
    10251025
    1026         $a2 = $this->factory->activity->create( array(
     1026        $a2 = self::factory()->activity->create( array(
    10271027            'component' => $bp->groups->id,
    10281028            'item_id'   => $g,
     
    10571057        $reset_current_action = $bp->current_action;
    10581058
    1059         $u1 = $this->factory->user->create();
    1060         $u2 = $this->factory->user->create();
    1061         $u3 = $this->factory->user->create();
     1059        $u1 = self::factory()->user->create();
     1060        $u2 = self::factory()->user->create();
     1061        $u3 = self::factory()->user->create();
    10621062
    10631063        $this->set_current_user( $u1 );
    10641064
    1065         $g = $this->factory->group->create( array(
     1065        $g = self::factory()->group->create( array(
    10661066            'status' => 'hidden',
    10671067        ) );
     
    10701070        groups_join_group( $g, $u3 );
    10711071
    1072         $a1 = $this->factory->activity->create( array(
     1072        $a1 = self::factory()->activity->create( array(
    10731073            'component' => $bp->groups->id,
    10741074            'item_id'   => $g,
     
    10781078        ) );
    10791079
    1080         $a2 = $this->factory->activity->create( array(
     1080        $a2 = self::factory()->activity->create( array(
    10811081            'component' => $bp->groups->id,
    10821082            'item_id'   => $g,
     
    11051105     */
    11061106    function test_bp_has_activities_with_meta_query() {
    1107         $a1 = $this->factory->activity->create();
    1108         $a2 = $this->factory->activity->create();
     1107        $a1 = self::factory()->activity->create();
     1108        $a2 = self::factory()->activity->create();
    11091109        bp_activity_update_meta( $a1, 'foo', 'bar' );
    11101110
     
    11291129    public function test_bp_has_activities_with_display_comments_false() {
    11301130        $now = time();
    1131         $a1 = $this->factory->activity->create( array(
     1131        $a1 = self::factory()->activity->create( array(
    11321132            'content' => 'Life Rules',
    11331133            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    11341134        ) );
    1135         $a2 = $this->factory->activity->create( array(
     1135        $a2 = self::factory()->activity->create( array(
    11361136            'content' => 'Life Drools',
    11371137            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
     
    11591159    public function test_bp_has_activities_with_display_comments_0() {
    11601160        $now = time();
    1161         $a1 = $this->factory->activity->create( array(
     1161        $a1 = self::factory()->activity->create( array(
    11621162            'content' => 'Life Rules',
    11631163            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    11641164        ) );
    1165         $a2 = $this->factory->activity->create( array(
     1165        $a2 = self::factory()->activity->create( array(
    11661166            'content' => 'Life Drools',
    11671167            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
     
    11891189    public function test_bp_has_activities_with_display_comments_0_querystring() {
    11901190        $now = time();
    1191         $a1 = $this->factory->activity->create( array(
     1191        $a1 = self::factory()->activity->create( array(
    11921192            'content' => 'Life Rules',
    11931193            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    11941194        ) );
    1195         $a2 = $this->factory->activity->create( array(
     1195        $a2 = self::factory()->activity->create( array(
    11961196            'content' => 'Life Drools',
    11971197            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
     
    12171217    public function test_bp_has_activities_with_display_comments_none_querystring() {
    12181218        $now = time();
    1219         $a1 = $this->factory->activity->create( array(
     1219        $a1 = self::factory()->activity->create( array(
    12201220            'content' => 'Life Rules',
    12211221            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    12221222        ) );
    1223         $a2 = $this->factory->activity->create( array(
     1223        $a2 = self::factory()->activity->create( array(
    12241224            'content' => 'Life Drools',
    12251225            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
     
    12451245    public function test_bp_has_activities_with_update_meta_cache_false() {
    12461246        $now = time();
    1247         $a1 = $this->factory->activity->create( array(
     1247        $a1 = self::factory()->activity->create( array(
    12481248            'content' => 'Life Rules',
    12491249            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    12501250        ) );
    1251         $a2 = $this->factory->activity->create( array(
     1251        $a2 = self::factory()->activity->create( array(
    12521252            'content' => 'Life Drools',
    12531253            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
     
    12721272    public function test_bp_has_activities_with_update_meta_cache_true() {
    12731273        $now = time();
    1274         $a1 = $this->factory->activity->create( array(
     1274        $a1 = self::factory()->activity->create( array(
    12751275            'content' => 'Life Rules',
    12761276            'recorded_time' => date( 'Y-m-d H:i:s', $now ),
    12771277        ) );
    1278         $a2 = $this->factory->activity->create( array(
     1278        $a2 = self::factory()->activity->create( array(
    12791279            'content' => 'Life Drools',
    12801280            'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ),
     
    13001300        add_filter( 'bp_disable_blogforum_comments', '__return_false' );
    13011301
    1302         $u = $this->factory->user->create();
    1303 
    1304         $now = time();
    1305         $a1 = $this->factory->activity->create( array(
     1302        $u = self::factory()->user->create();
     1303
     1304        $now = time();
     1305        $a1 = self::factory()->activity->create( array(
    13061306            'content' => 'Life Rules',
    13071307            'component' => 'blogs',
     
    13101310            'user_id' => $u,
    13111311        ) );
    1312         $a2 = $this->factory->activity->create( array(
     1312        $a2 = self::factory()->activity->create( array(
    13131313            'content' => 'Life Drools',
    13141314            'component' => 'blogs',
     
    13271327        ) );
    13281328
    1329         $a4 = $this->factory->activity->create( array(
     1329        $a4 = self::factory()->activity->create( array(
    13301330            'content' => 'Life Rulez',
    13311331            'component' => 'activity',
     
    15131513     */
    15141514    public function test_bp_activity_has_more_items_no_count_total_false() {
    1515         $a1 = $this->factory->activity->create();
    1516         $a2 = $this->factory->activity->create();
     1515        $a1 = self::factory()->activity->create();
     1516        $a2 = self::factory()->activity->create();
    15171517
    15181518        $args = array(
     
    15311531     */
    15321532    public function test_bp_activity_has_more_items_no_count_total_true() {
    1533         $a1 = $this->factory->activity->create();
    1534         $a2 = $this->factory->activity->create();
    1535         $a3 = $this->factory->activity->create();
    1536         $a4 = $this->factory->activity->create();
     1533        $a1 = self::factory()->activity->create();
     1534        $a2 = self::factory()->activity->create();
     1535        $a3 = self::factory()->activity->create();
     1536        $a4 = self::factory()->activity->create();
    15371537
    15381538        $args = array(
     
    15521552     */
    15531553    public function test_bp_activity_has_more_items_count_total_false() {
    1554         $a1 = $this->factory->activity->create();
    1555         $a2 = $this->factory->activity->create();
    1556         $a3 = $this->factory->activity->create();
    1557         $a4 = $this->factory->activity->create();
     1554        $a1 = self::factory()->activity->create();
     1555        $a2 = self::factory()->activity->create();
     1556        $a3 = self::factory()->activity->create();
     1557        $a4 = self::factory()->activity->create();
    15581558
    15591559        $args = array(
     
    15721572     */
    15731573    public function test_bp_activity_has_more_items_count_total_true() {
    1574         $a1 = $this->factory->activity->create();
    1575         $a2 = $this->factory->activity->create();
    1576         $a3 = $this->factory->activity->create();
    1577         $a4 = $this->factory->activity->create();
     1574        $a1 = self::factory()->activity->create();
     1575        $a2 = self::factory()->activity->create();
     1576        $a3 = self::factory()->activity->create();
     1577        $a4 = self::factory()->activity->create();
    15781578
    15791579        $args = array(
     
    16001600        }
    16011601
    1602         $a1 = $this->factory->activity->create();
    1603         $a2 = $this->factory->activity->create( array(
     1602        $a1 = self::factory()->activity->create();
     1603        $a2 = self::factory()->activity->create( array(
    16041604            'recorded_time' => '2001-01-01 12:00'
    16051605        ) );
    1606         $a3 = $this->factory->activity->create( array(
     1606        $a3 = self::factory()->activity->create( array(
    16071607            'recorded_time' => '2005-01-01 12:00'
    16081608        ) );
  • trunk/tests/phpunit/testcases/admin/functions.php

    r11513 r11737  
    99        parent::setUp();
    1010        $this->old_current_user = get_current_user_id();
    11         $this->set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     11        $this->set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
    1212
    1313        if ( ! function_exists( 'bp_admin' ) ) {
     
    139139        $bp->foo->name = 'Foo';
    140140        $bp->active_components[ $bp->foo->id ] = 1;
    141         $new_page_ids = array( $bp->foo->id => $this->factory->post->create( array(
     141        $new_page_ids = array( $bp->foo->id => self::factory()->post->create( array(
    142142            'post_type'  => 'page',
    143143            'post_title' => $bp->foo->name,
  • trunk/tests/phpunit/testcases/blogs/activity.php

    r10868 r11737  
    3030        }
    3131
    32         $b = $this->factory->blog->create();
    33         $u = $this->factory->user->create();
    34         $a = $this->factory->activity->create( array(
     32        $b = self::factory()->blog->create();
     33        $u = self::factory()->user->create();
     34        $a = self::factory()->activity->create( array(
    3535            'component' => buddypress()->blogs->id,
    3636            'type' => 'new_blog',
     
    5555        }
    5656
    57         $u = $this->factory->user->create();
    58         $p = $this->factory->post->create( array(
     57        $u = self::factory()->user->create();
     58        $p = self::factory()->post->create( array(
    5959            'post_author' => $u,
    6060        ) );
    61         $a = $this->factory->activity->create( array(
     61        $a = self::factory()->activity->create( array(
    6262            'component' => buddypress()->blogs->id,
    6363            'type' => 'new_blog_post',
     
    8989        }
    9090
    91         $u = $this->factory->user->create();
    92         $p = $this->factory->post->create( array(
     91        $u = self::factory()->user->create();
     92        $p = self::factory()->post->create( array(
    9393            'post_author' => $u,
    9494        ) );
    95         $a = $this->factory->activity->create( array(
     95        $a = self::factory()->activity->create( array(
    9696            'component' => buddypress()->blogs->id,
    9797            'type' => 'new_blog_post',
     
    123123        }
    124124
    125         $b = $this->factory->blog->create();
    126         $u = $this->factory->user->create();
     125        $b = self::factory()->blog->create();
     126        $u = self::factory()->user->create();
    127127
    128128        switch_to_blog( $b );
    129         $p = $this->factory->post->create( array(
     129        $p = self::factory()->post->create( array(
    130130            'post_author' => $u,
    131131        ) );
     
    133133        restore_current_blog();
    134134
    135         $a = $this->factory->activity->create( array(
     135        $a = self::factory()->activity->create( array(
    136136            'component' => buddypress()->blogs->id,
    137137            'type' => 'new_blog_post',
     
    164164        }
    165165
    166         $b = $this->factory->blog->create();
    167         $u = $this->factory->user->create();
     166        $b = self::factory()->blog->create();
     167        $u = self::factory()->user->create();
    168168
    169169        switch_to_blog( $b );
    170         $p = $this->factory->post->create( array(
     170        $p = self::factory()->post->create( array(
    171171            'post_author' => $u,
    172172        ) );
    173173        $p_obj = get_post( $p );
    174         $c = $this->factory->comment->create( array(
     174        $c = self::factory()->comment->create( array(
    175175            'comment_post_ID' => $p,
    176176        ) );
     
    178178        restore_current_blog();
    179179
    180         $a = $this->factory->activity->create( array(
     180        $a = self::factory()->activity->create( array(
    181181            'component' => buddypress()->blogs->id,
    182182            'type' => 'new_blog_comment',
     
    209209        add_filter( 'bp_blogs_activity_created_blog_action', array( $this, 'created_blog_passthrough' ), 10, 2 );
    210210
    211         $b = $this->factory->blog->create();
    212         $u = $this->factory->user->create();
     211        $b = self::factory()->blog->create();
     212        $u = self::factory()->user->create();
    213213
    214214        $recorded_blog          = new BP_Blogs_Blog;
     
    217217        $recorded_blog_id       = $recorded_blog->save();
    218218
    219         $a = $this->factory->activity->create( array(
     219        $a = self::factory()->activity->create( array(
    220220            'component' => buddypress()->blogs->id,
    221221            'type' => 'new_blog',
     
    237237        add_filter( 'bp_blogs_activity_new_post_action', array( $this, 'new_post_passthrough' ), 10, 2 );
    238238
    239         $b = $this->factory->blog->create();
     239        $b = self::factory()->blog->create();
    240240
    241241        switch_to_blog( $b );
    242         $p = $this->factory->post->create();
     242        $p = self::factory()->post->create();
    243243        restore_current_blog();
    244244
    245         $u = $this->factory->user->create();
    246         $a = $this->factory->activity->create( array(
     245        $u = self::factory()->user->create();
     246        $a = self::factory()->activity->create( array(
    247247            'component' => buddypress()->blogs->id,
    248248            'type' => 'new_blog_post',
     
    265265        add_filter( 'bp_blogs_activity_new_comment_action', array( $this, 'new_comment_passthrough' ), 10, 2 );
    266266
    267         $b = $this->factory->blog->create();
     267        $b = self::factory()->blog->create();
    268268
    269269        switch_to_blog( $b );
    270         $p = $this->factory->post->create();
    271         $c = $this->factory->comment->create( array(
     270        $p = self::factory()->post->create();
     271        $c = self::factory()->comment->create( array(
    272272            'comment_post_ID' => $p,
    273273        ) );
    274274        restore_current_blog();
    275275
    276         $u = $this->factory->user->create();
    277         $a = $this->factory->activity->create( array(
     276        $u = self::factory()->user->create();
     277        $a = self::factory()->activity->create( array(
    278278            'component' => buddypress()->blogs->id,
    279279            'type' => 'new_blog_comment',
     
    296296        }
    297297
    298         $u = $this->factory->user->create();
    299         $p = $this->factory->post->create( array( 'post_author' => $u, ) );
    300         $a = $this->factory->activity->create( array(
     298        $u = self::factory()->user->create();
     299        $p = self::factory()->post->create( array( 'post_author' => $u, ) );
     300        $a = self::factory()->activity->create( array(
    301301            'component'         => buddypress()->blogs->id,
    302302            'item_id'           => 1,
     
    322322        buddypress()->activity->actions = new stdClass();
    323323
    324         $u = $this->factory->user->create();
     324        $u = self::factory()->user->create();
    325325        $p = wp_insert_post( array(
    326326            'post_author' => $u,
     
    359359        buddypress()->activity->actions = new stdClass();
    360360
    361         $u = $this->factory->user->create();
     361        $u = self::factory()->user->create();
    362362        $p = wp_insert_post( array(
    363363            'post_author' => $u,
     
    409409    public function test_bp_blogs_sync_add_from_activity_comment() {
    410410        $old_user = get_current_user_id();
    411         $u = $this->factory->user->create();
     411        $u = self::factory()->user->create();
    412412        $this->set_current_user( $u );
    413413        $userdata = get_userdata( $u );
     
    417417
    418418        // create the blog post
    419         $post_id = $this->factory->post->create( array(
     419        $post_id = self::factory()->post->create( array(
    420420            'post_status' => 'publish',
    421421            'post_type'   => 'post',
     
    457457    public function test_bp_blogs_sync_delete_from_activity_comment() {
    458458        $old_user = get_current_user_id();
    459         $u = $this->factory->user->create();
     459        $u = self::factory()->user->create();
    460460        $this->set_current_user( $u );
    461461        $userdata = get_userdata( $u );
     
    465465
    466466        // create the blog post
    467         $post_id = $this->factory->post->create( array(
     467        $post_id = self::factory()->post->create( array(
    468468            'post_status' => 'publish',
    469469            'post_type'   => 'post',
     
    505505    public function test_bp_blogs_sync_activity_edit_to_post_comment_spam_unspam_activity_comment() {
    506506        $old_user = get_current_user_id();
    507         $u = $this->factory->user->create();
     507        $u = self::factory()->user->create();
    508508        $this->set_current_user( $u );
    509509        $userdata = get_userdata( $u );
     
    513513
    514514        // create the blog post
    515         $post_id = $this->factory->post->create( array(
     515        $post_id = self::factory()->post->create( array(
    516516            'post_status' => 'publish',
    517517            'post_type'   => 'post',
     
    565565    public function test_bp_blogs_sync_activity_edit_to_post_comment_spam_activity_comment_unspam_post_comment() {
    566566        $old_user = get_current_user_id();
    567         $u = $this->factory->user->create();
     567        $u = self::factory()->user->create();
    568568        $this->set_current_user( $u );
    569569        $userdata = get_userdata( $u );
     
    573573
    574574        // create the blog post
    575         $post_id = $this->factory->post->create( array(
     575        $post_id = self::factory()->post->create( array(
    576576            'post_status' => 'publish',
    577577            'post_type'   => 'post',
     
    623623    public function test_bp_blogs_sync_activity_edit_to_post_comment_trash_comment_ham_activity() {
    624624        $old_user = get_current_user_id();
    625         $u = $this->factory->user->create();
     625        $u = self::factory()->user->create();
    626626        $this->set_current_user( $u );
    627627        $userdata = get_userdata( $u );
     
    631631
    632632        // create the blog post
    633         $post_id = $this->factory->post->create( array(
     633        $post_id = self::factory()->post->create( array(
    634634            'post_status' => 'publish',
    635635            'post_type'   => 'post',
     
    680680    public function test_spammed_activity_comment_should_not_create_post_comment() {
    681681        $old_user = get_current_user_id();
    682         $u = $this->factory->user->create();
     682        $u = self::factory()->user->create();
    683683        $this->set_current_user( $u );
    684684        $userdata = get_userdata( $u );
     
    688688
    689689        // create the blog post.
    690         $post_id = $this->factory->post->create( array(
     690        $post_id = self::factory()->post->create( array(
    691691            'post_status' => 'publish',
    692692            'post_type'   => 'post',
  • trunk/tests/phpunit/testcases/blogs/cache.php

    r9839 r11737  
    1414        }
    1515
    16         $b1 = $this->factory->blog->create();
    17         $b2 = $this->factory->blog->create();
     16        $b1 = self::factory()->blog->create();
     17        $b2 = self::factory()->blog->create();
    1818
    1919        bp_blogs_add_blogmeta( $b1, 'foo', 'bar' );
     
    9595        }
    9696
    97         $u = $this->factory->user->create();
     97        $u = self::factory()->user->create();
    9898
    9999        // Switch user so we have access to non-public blogs
     
    101101        $this->set_current_user( $u );
    102102
    103         $b1 = $this->factory->blog->create();
    104         $b2 = $this->factory->blog->create();
     103        $b1 = self::factory()->blog->create();
     104        $b2 = self::factory()->blog->create();
    105105
    106106        bp_blogs_record_blog( $b1, $u, true );
     
    189189        }
    190190
    191         $u = $this->factory->user->create();
     191        $u = self::factory()->user->create();
    192192
    193193        // Switch user so we have access to non-public blogs
     
    195195        $this->set_current_user( $u );
    196196
    197         $b1 = $this->factory->blog->create();
    198         $b2 = $this->factory->blog->create();
     197        $b1 = self::factory()->blog->create();
     198        $b2 = self::factory()->blog->create();
    199199
    200200        bp_blogs_record_blog( $b1, $u, true );
     
    264264        }
    265265
    266         $u = $this->factory->user->create();
     266        $u = self::factory()->user->create();
    267267
    268268        // need to make sure we set the 'public' flag due to how BP_Blogs_Blogs:get_all() works
    269         $b1 = $this->factory->blog->create( array(
     269        $b1 = self::factory()->blog->create( array(
    270270            'meta' => array(
    271271                'public' => 1
    272272            )
    273273        ) );
    274         $b2 = $this->factory->blog->create( array(
     274        $b2 = self::factory()->blog->create( array(
    275275            'meta' => array(
    276276                'public' => 1
     
    298298        }
    299299
    300         $u = $this->factory->user->create();
    301 
    302         $b1 = $this->factory->blog->create();
     300        $u = self::factory()->user->create();
     301
     302        $b1 = self::factory()->blog->create();
    303303        bp_blogs_record_blog( $b1, $u, true );
    304304
  • trunk/tests/phpunit/testcases/blogs/class-bp-blogs-blog.php

    r9980 r11737  
    1313        $old_user = get_current_user_id();
    1414
    15         $u = $this->factory->user->create();
     15        $u = self::factory()->user->create();
    1616        $this->set_current_user( $u );
    17         $b = $this->factory->blog->create( array(
     17        $b = self::factory()->blog->create( array(
    1818            'title' => 'The Foo Bar Blog',
    1919            'user_id' => $u,
     
    4040        $old_user = get_current_user_id();
    4141
    42         $u = $this->factory->user->create();
     42        $u = self::factory()->user->create();
    4343        $this->set_current_user( $u );
    44         $b = $this->factory->blog->create( array(
     44        $b = self::factory()->blog->create( array(
    4545            'title' => 'The Foo Bar Blog',
    4646            'domain' => __METHOD__,
     
    6767        $old_user = get_current_user_id();
    6868
    69         $u = $this->factory->user->create();
     69        $u = self::factory()->user->create();
    7070        $this->set_current_user( $u );
    71         $b = $this->factory->blog->create( array(
     71        $b = self::factory()->blog->create( array(
    7272            'title' => 'The Foo Bar Blog',
    7373            'user_id' => $u,
     
    9595        $old_user = get_current_user_id();
    9696
    97         $u = $this->factory->user->create();
     97        $u = self::factory()->user->create();
    9898        $this->set_current_user( $u );
    99         $b = $this->factory->blog->create( array(
     99        $b = self::factory()->blog->create( array(
    100100            'title' => 'Foo Bar Blog',
    101101            'user_id' => $u,
     
    123123        $old_user = get_current_user_id();
    124124
    125         $u = $this->factory->user->create();
     125        $u = self::factory()->user->create();
    126126        $this->set_current_user( $u );
    127127        $bs = array(
    128             'foobar' => $this->factory->blog->create( array(
     128            'foobar' => self::factory()->blog->create( array(
    129129                'title' => 'Foo Bar Blog',
    130130                'user_id' => $u,
    131131                'path' => '/path' . rand() . time() . '/',
    132132            ) ),
    133             'barfoo' => $this->factory->blog->create( array(
     133            'barfoo' => self::factory()->blog->create( array(
    134134                'title' => 'Bar foo Blog',
    135135                'user_id' => $u,
  • trunk/tests/phpunit/testcases/blogs/filters.php

    r11256 r11737  
    4646     */
    4747    public function test_bp_activity_catch_transition_post_type_status() {
    48         $post_id = $this->factory->post->create( array(
     48        $post_id = self::factory()->post->create( array(
    4949            'post_status' => 'publish',
    5050            'post_type'   => 'using_old_filter',
     
    5959     */
    6060    public function test_bp_blogs_record_comment() {
    61         $u = $this->factory->user->create();
    62         $user = $this->factory->user->get_object_by_id( $u );
     61        $u = self::factory()->user->create();
     62        $user = self::factory()->user->get_object_by_id( $u );
    6363
    64         $post_id = $this->factory->post->create( array(
     64        $post_id = self::factory()->post->create( array(
    6565            'post_status' => 'publish',
    6666            'post_type'   => 'using_old_filter',
     
    6868        ) );
    6969
    70         $comment_id = $this->factory->comment->create( array(
     70        $comment_id = self::factory()->comment->create( array(
    7171            'user_id'              => $u,
    7272            'comment_author_email' => $user->user_email,
     
    7575
    7676        // Approve the comment
    77         $this->factory->comment->update_object( $comment_id, array( 'comment_approved' => 1 ) );
     77        self::factory()->comment->update_object( $comment_id, array( 'comment_approved' => 1 ) );
    7878
    7979        $this->assertTrue( $this->activity_exists_for_post_type( get_current_blog_id(), $comment_id, 'new_blog_comment' ), 'Generated activity for comments about a post type registering using the bp_blogs_record_post_post_types filter should have a new_blog_comment action' );
     
    8585     */
    8686    public function test_bp_blogs_record_comment_sync_activity_comment() {
    87         $u = $this->factory->user->create();
    88         $user = $this->factory->user->get_object_by_id( $u );
     87        $u = self::factory()->user->create();
     88        $user = self::factory()->user->get_object_by_id( $u );
    8989
    9090        add_filter( 'bp_disable_blogforum_comments', '__return_false' );
    9191
    92         $post_id = $this->factory->post->create( array(
     92        $post_id = self::factory()->post->create( array(
    9393            'post_status' => 'publish',
    9494            'post_type'   => 'using_old_filter',
     
    103103        ) );
    104104
    105         $comment_id = $this->factory->comment->create( array(
     105        $comment_id = self::factory()->comment->create( array(
    106106            'user_id'              => $u,
    107107            'comment_author_email' => $user->user_email,
     
    110110
    111111        // Approve the comment
    112         $this->factory->comment->update_object( $comment_id, array( 'comment_approved' => 1 ) );
     112        self::factory()->comment->update_object( $comment_id, array( 'comment_approved' => 1 ) );
    113113
    114114        $this->assertTrue( $this->activity_exists_for_post_type( $parent_activity_id, '', 'activity_comment', 'stream' ), 'Generated activity for comments about a post type registering using the bp_blogs_record_post_post_types filter having sync on should have a activity_comment action' );
  • trunk/tests/phpunit/testcases/blogs/functions.php

    r10971 r11737  
    289289
    290290        // Create a regular member
    291         $u = $this->factory->user->create();
     291        $u = self::factory()->user->create();
    292292
    293293        // Create blogs
    294         $b1 = $this->factory->blog->create( array( 'user_id' => $u ) );
    295         $b2 = $this->factory->blog->create( array( 'user_id' => $u ) );
     294        $b1 = self::factory()->blog->create( array( 'user_id' => $u ) );
     295        $b2 = self::factory()->blog->create( array( 'user_id' => $u ) );
    296296
    297297        $expected = array(
     
    323323     */
    324324    public function test_transition_post_status_publish_to_publish() {
    325         $post_id = $this->factory->post->create( array(
     325        $post_id = self::factory()->post->create( array(
    326326            'post_status' => 'publish',
    327327            'post_type' => 'post',
     
    344344     */
    345345    public function test_transition_post_status_password_publish() {
    346         $post_id = $this->factory->post->create( array(
     346        $post_id = self::factory()->post->create( array(
    347347            'post_status'   => 'publish',
    348348            'post_type'     => 'post',
     
    359359     */
    360360    public function test_transition_post_status_publish_update_password() {
    361         $post_id = $this->factory->post->create( array(
     361        $post_id = self::factory()->post->create( array(
    362362            'post_status'   => 'publish',
    363363            'post_type'     => 'post',
     
    380380     */
    381381    public function test_transition_post_status_private_publish() {
    382         $post_id = $this->factory->post->create( array(
     382        $post_id = self::factory()->post->create( array(
    383383            'post_status'   => 'private',
    384384            'post_type'     => 'post',
     
    401401     */
    402402    public function test_transition_post_status_publish_private() {
    403         $post_id = $this->factory->post->create( array(
     403        $post_id = self::factory()->post->create( array(
    404404            'post_status'   => 'publish',
    405405            'post_type'     => 'post',
     
    422422     */
    423423    public function test_transition_post_status_draft_to_draft() {
    424         $post_id = $this->factory->post->create( array(
     424        $post_id = self::factory()->post->create( array(
    425425            'post_status' => 'draft',
    426426            'post_type' => 'post',
     
    442442     */
    443443    public function test_transition_post_status_draft_to_publish() {
    444         $post_id = $this->factory->post->create( array(
     444        $post_id = self::factory()->post->create( array(
    445445            'post_status' => 'draft',
    446446            'post_type' => 'post',
     
    462462     */
    463463    public function test_transition_post_status_publish_to_draft() {
    464         $post_id = $this->factory->post->create( array(
     464        $post_id = self::factory()->post->create( array(
    465465            'post_status' => 'publish',
    466466            'post_type' => 'post',
     
    482482     */
    483483    public function test_transition_post_status_wp_delete_post() {
    484         $post_id = $this->factory->post->create( array(
     484        $post_id = self::factory()->post->create( array(
    485485            'post_status' => 'publish',
    486486            'post_type' => 'post',
     
    499499     */
    500500    public function test_transition_post_status_wp_trash_post() {
    501         $post_id = $this->factory->post->create( array(
     501        $post_id = self::factory()->post->create( array(
    502502            'post_status' => 'publish',
    503503            'post_type' => 'post',
     
    519519        // save the current user and override logged-in user
    520520        $old_user = get_current_user_id();
    521         $u = $this->factory->user->create();
     521        $u = self::factory()->user->create();
    522522        $this->set_current_user( $u );
    523523        $userdata = get_userdata( $u );
    524524
    525525        // create the blog post
    526         $post_id = $this->factory->post->create( array(
     526        $post_id = self::factory()->post->create( array(
    527527            'post_status' => 'publish',
    528528            'post_type' => 'post',
     
    604604        // save the current user and override logged-in user
    605605        $old_user = get_current_user_id();
    606         $u = $this->factory->user->create();
     606        $u = self::factory()->user->create();
    607607        $this->set_current_user( $u );
    608608        $userdata = get_userdata( $u );
    609609
    610610        // create the blog post
    611         $post_id = $this->factory->post->create( array(
     611        $post_id = self::factory()->post->create( array(
    612612            'post_status' => 'publish',
    613613            'post_type' => 'post',
     
    666666    public function test_bp_blogs_post_type_remove_comment() {
    667667        $old_user = get_current_user_id();
    668         $u = $this->factory->user->create();
     668        $u = self::factory()->user->create();
    669669        $this->set_current_user( $u );
    670670        $userdata = get_userdata( $u );
    671671
    672672        // create the blog post
    673         $p = $this->factory->post->create( array(
     673        $p = self::factory()->post->create( array(
    674674            'post_status' => 'publish',
    675675            'post_type' => 'post',
     
    708708        add_filter( 'bp_blogs_is_blog_trackable', '__return_false' );
    709709
    710         $post_id = $this->factory->post->create( array(
     710        $post_id = self::factory()->post->create( array(
    711711            'post_status'   => 'publish',
    712712            'post_type'     => 'post',
     
    737737        add_filter( 'bp_is_blog_public', '__return_zero' );
    738738
    739         $post_id = $this->factory->post->create( array(
     739        $post_id = self::factory()->post->create( array(
    740740            'post_status'   => 'publish',
    741741            'post_type'     => 'post',
     
    764764        // save the current user and override logged-in user
    765765        $old_user = get_current_user_id();
    766         $u = $this->factory->user->create();
     766        $u = self::factory()->user->create();
    767767        $this->set_current_user( $u );
    768768        $userdata = get_userdata( $u );
     
    777777
    778778        // create the blog post
    779         $post_id = $this->factory->post->create( array(
     779        $post_id = self::factory()->post->create( array(
    780780            'post_status' => 'publish',
    781781            'post_type'   => 'post',
     
    828828        // Save the current user and override logged-in user
    829829        $old_user = get_current_user_id();
    830         $u = $this->factory->user->create();
     830        $u = self::factory()->user->create();
    831831        $this->set_current_user( $u );
    832832
     
    838838
    839839        // Create the blog post
    840         $post_id = $this->factory->post->create( array(
     840        $post_id = self::factory()->post->create( array(
    841841            'post_status' => 'publish',
    842842            'post_type'   => 'post',
     
    887887    public function test_bp_blogs_comment_sync_activity_comment_for_custom_post_type() {
    888888        if ( is_multisite() ) {
    889             $b = $this->factory->blog->create();
     889            $b = self::factory()->blog->create();
    890890            switch_to_blog( $b );
    891891            add_filter( 'comment_flood_filter', '__return_false' );
     
    894894        }
    895895
    896         $u = $this->factory->user->create();
     896        $u = self::factory()->user->create();
    897897        $userdata = get_userdata( $u );
    898898
     
    916916        add_filter( 'bp_disable_blogforum_comments', '__return_false' );
    917917
    918         $p = $this->factory->post->create( array(
     918        $p = self::factory()->post->create( array(
    919919            'post_author' => $u,
    920920            'post_type'   => 'foo',
     
    995995        $old_user = get_current_user_id();
    996996
    997         $u = $this->factory->user->create();
     997        $u = self::factory()->user->create();
    998998        $this->set_current_user( $u );
    999999
    10001000        // Create three sites.
    1001         $this->factory->blog->create_many( 3, array(
     1001        self::factory()->blog->create_many( 3, array(
    10021002            'user_id' => $u
    10031003        ) );
     
    10311031        $_POST['blog_public'] = 1;
    10321032
    1033         $u = $this->factory->user->create();
     1033        $u = self::factory()->user->create();
    10341034        $this->set_current_user( $u );
    10351035
    10361036        // Create three sites.
    1037         $b = $this->factory->blog->create( array(
     1037        $b = self::factory()->blog->create( array(
    10381038            'user_id' => $u
    10391039        ) );
     
    10781078        $_POST['blog_public'] = 1;
    10791079
    1080         $u = $this->factory->user->create();
     1080        $u = self::factory()->user->create();
    10811081        $this->set_current_user( $u );
    10821082
    10831083        // Create three sites.
    1084         $b = $this->factory->blog->create( array(
     1084        $b = self::factory()->blog->create( array(
    10851085            'user_id' => $u
    10861086        ) );
    10871087
    1088         $u2 = $this->factory->user->create();
     1088        $u2 = self::factory()->user->create();
    10891089        add_user_to_blog( $b, $u2, 'contributor' );
    10901090
  • trunk/tests/phpunit/testcases/core/avatars.php

    r11256 r11737  
    2626        }
    2727
    28         $u = $this->factory->user->create();
     28        $u = self::factory()->user->create();
    2929
    3030        // get BP root blog's upload directory data
     
    3232
    3333        // create new subsite
    34         $blog_id = $this->factory->blog->create( array(
     34        $blog_id = self::factory()->blog->create( array(
    3535            'user_id' => $u,
    3636            'title'   => 'Test Title',
     
    5454        $this->clean_existing_avatars();
    5555
    56         $u = $this->factory->user->create();
     56        $u = self::factory()->user->create();
    5757        $this->assertFalse( bp_get_user_has_avatar( $u ) );
    5858    }
     
    6262     */
    6363    public function test_bp_get_user_has_avatar_has_avatar_uploaded() {
    64         $u = $this->factory->user->create();
     64        $u = self::factory()->user->create();
    6565
    6666        // Fake it
     
    176176     */
    177177    public function test_bp_core_fetch_avatar_class_attribute() {
    178         $u = $this->factory->user->create();
     178        $u = self::factory()->user->create();
    179179
    180180        $hw = 100;
  • trunk/tests/phpunit/testcases/core/cache.php

    r9819 r11737  
    1111    public function test_bp_update_meta_cache_with_cache_misses() {
    1212        // Use activity just because
    13         $a1 = $this->factory->activity->create();
     13        $a1 = self::factory()->activity->create();
    1414
    1515        // Confirm that all activitymeta is deleted
  • trunk/tests/phpunit/testcases/core/caps.php

    r11256 r11737  
    1111        }
    1212
    13         $b = $this->factory->blog->create();
    14         $u = $this->factory->user->create();
     13        $b = self::factory()->blog->create();
     14        $u = self::factory()->user->create();
    1515
    1616        $this->set_current_user( $u );
     
    3333        }
    3434
    35         $b = $this->factory->blog->create();
    36         $u = $this->factory->user->create();
     35        $b = self::factory()->blog->create();
     36        $u = self::factory()->user->create();
    3737
    3838        $this->set_current_user( $u );
  • trunk/tests/phpunit/testcases/core/class-bp-attachment.php

    r11540 r11737  
    224224        $bp->displayed_user = new stdClass;
    225225
    226         $u1 = $this->factory->user->create();
     226        $u1 = self::factory()->user->create();
    227227        $bp->displayed_user->id = $u1;
    228228
     
    274274        $reset_current_group = $bp->groups->current_group;
    275275
    276         $g = $this->factory->group->create();
     276        $g = self::factory()->group->create();
    277277
    278278        $bp->groups->current_group = groups_get_group( $g );
     
    348348        $bp->displayed_user = new stdClass;
    349349
    350         $u1 = $this->factory->user->create();
     350        $u1 = self::factory()->user->create();
    351351        $bp->displayed_user->id = $u1;
    352352
  • trunk/tests/phpunit/testcases/core/class-bp-button.php

    r11117 r11737  
    1010     */
    1111    public function test_block_self_own_profile() {
    12         $u = $this->factory->user->create();
     12        $u = self::factory()->user->create();
    1313        $this->set_current_user( $u );
    1414
     
    2828     */
    2929    public function test_block_self_others_profile() {
    30         $u1 = $this->factory->user->create();
    31         $this->set_current_user( $u1 );
    32 
    33         $u2 = $this->factory->user->create();
     30        $u1 = self::factory()->user->create();
     31        $this->set_current_user( $u1 );
     32
     33        $u2 = self::factory()->user->create();
    3434        $this->go_to( bp_core_get_user_domain( $u2 ) );
    3535
     
    4848    public function test_block_self_inside_members_loop() {
    4949        $now = time();
    50         $u1 = $this->factory->user->create( array(
     50        $u1 = self::factory()->user->create( array(
    5151            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    5252        ) );
    53         $u2 = $this->factory->user->create( array(
     53        $u2 = self::factory()->user->create( array(
    5454            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    5555        ) );
     
    8888    public function test_block_self_false_inside_members_loop() {
    8989        $now = time();
    90         $u1 = $this->factory->user->create( array(
     90        $u1 = self::factory()->user->create( array(
    9191            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    9292        ) );
    93         $u2 = $this->factory->user->create( array(
     93        $u2 = self::factory()->user->create( array(
    9494            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    9595        ) );
     
    128128    public function test_block_self_inside_members_loop_on_my_profile_page() {
    129129        $now = time();
    130         $u1 = $this->factory->user->create( array(
     130        $u1 = self::factory()->user->create( array(
    131131            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    132132        ) );
    133         $u2 = $this->factory->user->create( array(
     133        $u2 = self::factory()->user->create( array(
    134134            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    135135        ) );
  • trunk/tests/phpunit/testcases/core/class-bp-core-user.php

    r9819 r11737  
    1010     */
    1111    public function test_get_users_with_exclude_querystring() {
    12         $u1 = $this->factory->user->create();
    13         $u2 = $this->factory->user->create();
    14         $u3 = $this->factory->user->create();
     12        $u1 = self::factory()->user->create();
     13        $u2 = self::factory()->user->create();
     14        $u3 = self::factory()->user->create();
    1515
    1616        $exclude_qs = $u1 . ',junkstring,' . $u3;
     
    2626     */
    2727    public function test_get_users_with_exclude_array() {
    28         $u1 = $this->factory->user->create();
    29         $u2 = $this->factory->user->create();
    30         $u3 = $this->factory->user->create();
     28        $u1 = self::factory()->user->create();
     29        $u2 = self::factory()->user->create();
     30        $u3 = self::factory()->user->create();
    3131
    3232        $exclude_array = array(
     
    4646     */
    4747    public function test_get_users_with_include_querystring() {
    48         $u1 = $this->factory->user->create( array(
     48        $u1 = self::factory()->user->create( array(
    4949            'last_activity' => gmdate( 'Y-m-d H:i:s' ),
    5050        ) );
    51         $u2 = $this->factory->user->create( array(
     51        $u2 = self::factory()->user->create( array(
    5252            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
    5353        ) );
    54         $u3 = $this->factory->user->create( array(
     54        $u3 = self::factory()->user->create( array(
    5555            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
    5656        ) );
     
    6868     */
    6969    public function test_get_users_with_include_array() {
    70         $u1 = $this->factory->user->create( array(
     70        $u1 = self::factory()->user->create( array(
    7171            'last_activity' => gmdate( 'Y-m-d H:i:s' ),
    7272        ) );
    73         $u2 = $this->factory->user->create( array(
     73        $u2 = self::factory()->user->create( array(
    7474            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
    7575        ) );
    76         $u3 = $this->factory->user->create( array(
     76        $u3 = self::factory()->user->create( array(
    7777            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
    7878        ) );
     
    100100     */
    101101    public function test_type_alphabetical() {
    102         $u1 = $this->factory->user->create( array(
     102        $u1 = self::factory()->user->create( array(
    103103            'display_name' => 'foo',
    104104        ) );
    105         $u2 = $this->factory->user->create( array(
     105        $u2 = self::factory()->user->create( array(
    106106            'display_name' => 'bar',
    107107        ) );
     
    119119     */
    120120    public function test_get_users_by_letter() {
    121         $u1 = $this->factory->user->create( array(
     121        $u1 = self::factory()->user->create( array(
    122122            'display_name' => 'foo',
    123123        ) );
    124         $u2 = $this->factory->user->create( array(
     124        $u2 = self::factory()->user->create( array(
    125125            'display_name' => 'bar',
    126126        ) );
     
    136136     */
    137137    public function test_search_users() {
    138         $u1 = $this->factory->user->create( array(
     138        $u1 = self::factory()->user->create( array(
    139139            'display_name' => 'foo',
    140140        ) );
    141         $u2 = $this->factory->user->create( array(
     141        $u2 = self::factory()->user->create( array(
    142142            'display_name' => 'bar',
    143143        ) );
     
    150150
    151151    public function test_get_specific_users() {
    152         $u1 = $this->factory->user->create();
    153         $u2 = $this->factory->user->create();
    154         $u3 = $this->factory->user->create();
     152        $u1 = self::factory()->user->create();
     153        $u2 = self::factory()->user->create();
     154        $u3 = self::factory()->user->create();
    155155
    156156        $include_array = array(
     
    170170     */
    171171    public function test_get_last_activity() {
    172         $u = $this->factory->user->create();
     172        $u = self::factory()->user->create();
    173173        $time = bp_core_current_time();
    174174
     
    186186     */
    187187    public function test_get_last_activity_store_in_cache() {
    188         $u = $this->factory->user->create();
     188        $u = self::factory()->user->create();
    189189        $time = bp_core_current_time();
    190190
     
    204204     */
    205205    public function test_get_last_activity_store_in_cache_multiple_users() {
    206         $u1 = $this->factory->user->create();
    207         $u2 = $this->factory->user->create();
     206        $u1 = self::factory()->user->create();
     207        $u2 = self::factory()->user->create();
    208208        $time = bp_core_current_time();
    209209
     
    225225     */
    226226    public function test_get_last_activity_from_cache_single_user() {
    227         $u    = $this->factory->user->create();
     227        $u    = self::factory()->user->create();
    228228        $time = bp_core_current_time();
    229229
     
    248248     */
    249249    public function test_get_last_activity_in_cache_multiple_users() {
    250         $u1 = $this->factory->user->create();
    251         $u2 = $this->factory->user->create();
     250        $u1 = self::factory()->user->create();
     251        $u2 = self::factory()->user->create();
    252252        $time = bp_core_current_time();
    253253
     
    273273     */
    274274    public function test_update_last_activity() {
    275         $u = $this->factory->user->create();
     275        $u = self::factory()->user->create();
    276276        $time = bp_core_current_time();
    277277        $time2 = '1968-12-25 01:23:45';
     
    292292     */
    293293    public function test_delete_last_activity() {
    294         $u = $this->factory->user->create();
     294        $u = self::factory()->user->create();
    295295        $time = bp_core_current_time();
    296296
  • trunk/tests/phpunit/testcases/core/class-bp-email-recipient.php

    r10792 r11737  
    1010        parent::setUp();
    1111
    12         $this->u1 = $this->factory->user->create( array(
     12        $this->u1 = self::factory()->user->create( array(
    1313            'display_name' => 'Unit Test',
    1414            'user_email'   => 'test@example.com',
  • trunk/tests/phpunit/testcases/core/class-bp-email.php

    r10761 r11737  
    1111        parent::setUp();
    1212
    13         $this->u1 = $this->factory->user->create( array(
     13        $this->u1 = self::factory()->user->create( array(
    1414            'display_name' => 'Unit Test',
    1515            'user_email'   => 'test1@example.com',
    1616        ) );
    1717
    18         $this->u2 = $this->factory->user->create( array(
     18        $this->u2 = self::factory()->user->create( array(
    1919            'display_name' => 'Unit Test2',
    2020            'user_email'   => 'test2@example.com',
  • trunk/tests/phpunit/testcases/core/class-bp-media-extractor.php

    r10223 r11737  
    144144
    145145    public function test_extract_multiple_media_types_from_content() {
    146         $this->factory->user->create( array( 'user_login' => 'paulgibbs' ) );
     146        self::factory()->user->create( array( 'user_login' => 'paulgibbs' ) );
    147147        $media = self::$media_extractor->extract( self::$richtext, BP_Media_Extractor::LINKS | BP_Media_Extractor::MENTIONS );
    148148
     
    153153
    154154    public function test_extract_media_from_a_wp_post() {
    155         $post_id = $this->factory->post->create( array( 'post_content' => self::$richtext ) );
     155        $post_id = self::factory()->post->create( array( 'post_content' => self::$richtext ) );
    156156        $media   = self::$media_extractor->extract( get_post( $post_id ), BP_Media_Extractor::LINKS );
    157157
     
    190190
    191191    public function test_extract_mentions_from_content_with_activity_enabled() {
    192         $this->factory->user->create( array( 'user_login' => 'paulgibbs' ) );
     192        self::factory()->user->create( array( 'user_login' => 'paulgibbs' ) );
    193193        $media = self::$media_extractor->extract( self::$richtext, BP_Media_Extractor::MENTIONS );
    194194
     
    198198
    199199    public function test_extract_mentions_from_content_with_activity_disabled() {
    200         $this->factory->user->create( array( 'user_login' => 'paulgibbs' ) );
     200        self::factory()->user->create( array( 'user_login' => 'paulgibbs' ) );
    201201        $was_activity_enabled = false;
    202202
     
    304304    public function test_extract_images_from_content_with_galleries_variant_no_ids() {
    305305        // To test the [gallery] shortcode, we need to create a post and an attachment.
    306         $post_id       = $this->factory->post->create( array( 'post_content' => self::$richtext ) );
    307         $attachment_id = $this->factory->attachment->create_object( 'image.jpg', $post_id, array(
     306        $post_id       = self::factory()->post->create( array( 'post_content' => self::$richtext ) );
     307        $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array(
    308308            'post_mime_type' => 'image/jpeg',
    309309            'post_type'      => 'attachment'
     
    329329        $attachment_ids[] = $this->fake_attachment_upload( DIR_TESTDATA . '/images/canola.jpg' );
    330330        $attachment_ids   = join( ',', $attachment_ids );
    331         $post_id          = $this->factory->post->create( array( 'post_content' => "[gallery ids='{$attachment_ids}']" ) );
     331        $post_id          = self::factory()->post->create( array( 'post_content' => "[gallery ids='{$attachment_ids}']" ) );
    332332
    333333        // Extract the gallery images.
     
    345345
    346346    public function test_extract_no_images_from_content_with_invalid_galleries_variant_no_ids() {
    347         $post_id = $this->factory->post->create( array( 'post_content' => self::$richtext ) );
     347        $post_id = self::factory()->post->create( array( 'post_content' => self::$richtext ) );
    348348        $media   = self::$media_extractor->extract( self::$richtext, BP_Media_Extractor::IMAGES, array(
    349349            'post' => get_post( $post_id ),
     
    356356
    357357    public function test_extract_no_images_from_content_with_invalid_galleries_variant_ids() {
    358         $post_id = $this->factory->post->create( array( 'post_content' => '[gallery ids="117,4529"]' ) );
     358        $post_id = self::factory()->post->create( array( 'post_content' => '[gallery ids="117,4529"]' ) );
    359359        $media   = self::$media_extractor->extract( '', BP_Media_Extractor::IMAGES, array(
    360360            'post' => get_post( $post_id ),
     
    372372
    373373    public function test_extract_no_images_from_content_with_featured_image() {
    374         $post_id      = $this->factory->post->create( array( 'post_content' => self::$richtext ) );
    375         $thumbnail_id = $this->factory->attachment->create_object( 'image.jpg', $post_id, array(
     374        $post_id      = self::factory()->post->create( array( 'post_content' => self::$richtext ) );
     375        $thumbnail_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array(
    376376            'post_mime_type' => 'image/jpeg',
    377377            'post_type'      => 'attachment'
     
    393393
    394394    public function test_extract_images_from_content_without_featured_image() {
    395         $post_id = $this->factory->post->create( array( 'post_content' => self::$richtext ) );
     395        $post_id = self::factory()->post->create( array( 'post_content' => self::$richtext ) );
    396396        $media   = self::$media_extractor->extract( '', BP_Media_Extractor::IMAGES, array(
    397397            'post' => get_post( $post_id ),
  • trunk/tests/phpunit/testcases/core/class-bp-user-query.php

    r11366 r11737  
    1010     */
    1111    public function test_bp_user_query_friends() {
    12         $u1 = $this->factory->user->create();
    13         $u2 = $this->factory->user->create();
    14         $u3 = $this->factory->user->create();
     12        $u1 = self::factory()->user->create();
     13        $u2 = self::factory()->user->create();
     14        $u3 = self::factory()->user->create();
    1515        friends_add_friend( $u1, $u2, true );
    1616
     
    2828     */
    2929    public function test_bp_user_query_friends_with_include() {
    30         $u1 = $this->factory->user->create();
    31         $u2 = $this->factory->user->create();
    32         $u3 = $this->factory->user->create();
    33         $u4 = $this->factory->user->create();
     30        $u1 = self::factory()->user->create();
     31        $u2 = self::factory()->user->create();
     32        $u3 = self::factory()->user->create();
     33        $u4 = self::factory()->user->create();
    3434        friends_add_friend( $u1, $u2, true );
    3535        friends_add_friend( $u1, $u3, true );
     
    4949
    5050    public function test_bp_user_query_friends_with_include_but_zero_friends() {
    51         $u1 = $this->factory->user->create();
    52         $u2 = $this->factory->user->create();
    53         $u3 = $this->factory->user->create();
    54         $u4 = $this->factory->user->create();
     51        $u1 = self::factory()->user->create();
     52        $u2 = self::factory()->user->create();
     53        $u3 = self::factory()->user->create();
     54        $u4 = self::factory()->user->create();
    5555
    5656        $q = new BP_User_Query( array(
     
    9494    public function test_bp_user_query_user_ids_with_invalid_user_id() {
    9595        $now = time();
    96         $u1 = $this->factory->user->create();
    97         $u2 = $this->factory->user->create();
     96        $u1 = self::factory()->user->create();
     97        $u2 = self::factory()->user->create();
    9898
    9999        // invalid user ID
     
    116116
    117117    public function test_bp_user_query_sort_by_popular() {
    118         $u1 = $this->factory->user->create();
    119         $u2 = $this->factory->user->create();
    120         $u3 = $this->factory->user->create();
    121         $u4 = $this->factory->user->create();
     118        $u1 = self::factory()->user->create();
     119        $u2 = self::factory()->user->create();
     120        $u3 = self::factory()->user->create();
     121        $u4 = self::factory()->user->create();
    122122
    123123        bp_update_user_meta( $u1, bp_get_user_meta_key( 'total_friend_count' ), '5' );
     
    142142    public function test_bp_user_query_type_online() {
    143143        $now = time();
    144         $u1 = $this->factory->user->create( array(
     144        $u1 = self::factory()->user->create( array(
    145145            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    146146        ) );
    147         $u2 = $this->factory->user->create( array(
     147        $u2 = self::factory()->user->create( array(
    148148            'last_activity' => date( 'Y-m-d H:i:s', $now - 60*13 ),
    149149        ) );
    150         $u3 = $this->factory->user->create( array(
     150        $u3 = self::factory()->user->create( array(
    151151            'last_activity' => date( 'Y-m-d H:i:s', $now - 60*16 ),
    152152        ) );
     
    166166    public function test_bp_user_query_type_online_five_minute_interval() {
    167167        $now = time();
    168         $u1 = $this->factory->user->create( array(
     168        $u1 = self::factory()->user->create( array(
    169169            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    170170        ) );
    171         $u2 = $this->factory->user->create( array(
     171        $u2 = self::factory()->user->create( array(
    172172            'last_activity' => date( 'Y-m-d H:i:s', $now - 60*4 ),
    173173        ) );
    174         $u3 = $this->factory->user->create( array(
     174        $u3 = self::factory()->user->create( array(
    175175            'last_activity' => date( 'Y-m-d H:i:s', $now - 60*6 ),
    176176        ) );
     
    190190    public function test_bp_user_query_search_with_apostrophe() {
    191191        // Apostrophe. Search_terms must escaped to mimic POST payload
    192         $user_id = $this->factory->user->create();
     192        $user_id = self::factory()->user->create();
    193193        xprofile_set_field_data( 1, $user_id, "Foo'Bar" );
    194194        $q = new BP_User_Query( array( 'search_terms' => "oo\'Ba", ) );
     
    206206
    207207        // LIKE special character: %
    208         $user_id = $this->factory->user->create();
     208        $user_id = self::factory()->user->create();
    209209        xprofile_set_field_data( 1, $user_id, "Foo%Bar" );
    210210        $q = new BP_User_Query( array( 'search_terms' => "oo%Bar", ) );
     
    223223
    224224        // LIKE special character: _
    225         $user_id = $this->factory->user->create();
     225        $user_id = self::factory()->user->create();
    226226        xprofile_set_field_data( 1, $user_id, "Foo_Bar" );
    227227        $q = new BP_User_Query( array( 'search_terms' => "oo_Bar", ) );
     
    239239
    240240        // LIKE special character: &
    241         $user_id = $this->factory->user->create();
     241        $user_id = self::factory()->user->create();
    242242        xprofile_set_field_data( 1, $user_id, "a&mpersand" );
    243243        $q = new BP_User_Query( array( 'search_terms' => "a&m", ) );
     
    257257     */
    258258    public function test_bp_user_query_search_core_fields() {
    259         $user_id = $this->factory->user->create( array(
     259        $user_id = self::factory()->user->create( array(
    260260            'user_login' => 'foo',
    261261        ) );
     
    273273
    274274    public function test_bp_user_query_search_wildcards() {
    275         $u1 = $this->factory->user->create( array(
     275        $u1 = self::factory()->user->create( array(
    276276            'user_login' => 'xfoo',
    277277        ) );
     
    279279        $q1 = new BP_User_Query( array( 'search_terms' => 'foo', 'search_wildcard' => 'left' ) );
    280280
    281         $u2 = $this->factory->user->create( array(
     281        $u2 = self::factory()->user->create( array(
    282282            'user_login' => 'foox',
    283283        ) );
     
    285285        $q2 = new BP_User_Query( array( 'search_terms' => 'foo', 'search_wildcard' => 'right' ) );
    286286
    287         $u3 = $this->factory->user->create( array(
     287        $u3 = self::factory()->user->create( array(
    288288            'user_login' => 'xfoox',
    289289        ) );
     
    313313        $existing_users = $wpdb->get_col( "SELECT ID FROM {$wpdb->users}" );
    314314
    315         $u1 = $this->factory->user->create();
    316         $u2 = $this->factory->user->create();
     315        $u1 = self::factory()->user->create();
     316        $u2 = self::factory()->user->create();
    317317
    318318        $exclude = array_merge( array( $u1 ), $existing_users );
     
    341341        add_filter( 'bp_disable_profile_sync', '__return_false' );
    342342
    343         $u1 = $this->factory->user->create();
    344         $u2 = $this->factory->user->create();
     343        $u1 = self::factory()->user->create();
     344        $u2 = self::factory()->user->create();
    345345
    346346        global $wpdb;
     
    372372     */
    373373    public function test_bp_user_query_type_alphabetical_spam_xprofileoff() {
    374         $u1 = $this->factory->user->create();
    375         $u2 = $this->factory->user->create();
     374        $u1 = self::factory()->user->create();
     375        $u2 = self::factory()->user->create();
    376376
    377377        // Make sure xprofile and profile sync are off
     
    407407     */
    408408    public function test_bp_user_query_with_user_meta_argument() {
    409         $u1 = $this->factory->user->create();
    410         $u2 = $this->factory->user->create();
     409        $u1 = self::factory()->user->create();
     410        $u2 = self::factory()->user->create();
    411411
    412412        bp_update_user_meta( $u2, 'foo', 'bar' );
     
    429429     */
    430430    public function test_bp_user_query_with_user_meta_argument_no_user() {
    431         $u1 = $this->factory->user->create();
    432         $u2 = $this->factory->user->create();
     431        $u1 = self::factory()->user->create();
     432        $u2 = self::factory()->user->create();
    433433
    434434        $q = new BP_User_Query( array(
     
    448448        bp_register_member_type( 'foo' );
    449449        bp_register_member_type( 'bar' );
    450         $users = $this->factory->user->create_many( 3 );
     450        $users = self::factory()->user->create_many( 3 );
    451451        bp_set_member_type( $users[0], 'foo' );
    452452        bp_set_member_type( $users[1], 'bar' );
     
    466466        bp_register_member_type( 'foo' );
    467467        bp_register_member_type( 'bar' );
    468         $users = $this->factory->user->create_many( 3 );
     468        $users = self::factory()->user->create_many( 3 );
    469469        bp_set_member_type( $users[0], 'foo' );
    470470        bp_set_member_type( $users[1], 'bar' );
     
    484484        bp_register_member_type( 'foo' );
    485485        bp_register_member_type( 'bar' );
    486         $users = $this->factory->user->create_many( 3 );
     486        $users = self::factory()->user->create_many( 3 );
    487487        bp_set_member_type( $users[0], 'foo' );
    488488        bp_set_member_type( $users[1], 'bar' );
     
    502502        bp_register_member_type( 'foo' );
    503503        bp_register_member_type( 'bar' );
    504         $users = $this->factory->user->create_many( 3 );
     504        $users = self::factory()->user->create_many( 3 );
    505505        bp_set_member_type( $users[0], 'foo' );
    506506        bp_set_member_type( $users[1], 'bar' );
     
    520520        bp_register_member_type( 'foo' );
    521521        bp_register_member_type( 'bar' );
    522         $users = $this->factory->user->create_many( 3 );
     522        $users = self::factory()->user->create_many( 3 );
    523523        bp_set_member_type( $users[0], 'foo' );
    524524        bp_set_member_type( $users[1], 'bar' );
     
    538538    public function test_should_return_no_results_when_no_users_match_the_specified_member_type() {
    539539        bp_register_member_type( 'foo' );
    540         $users = $this->factory->user->create_many( 3 );
     540        $users = self::factory()->user->create_many( 3 );
    541541
    542542        $q = new BP_User_Query( array(
     
    553553        bp_register_member_type( 'foo' );
    554554        bp_register_member_type( 'bar' );
    555         $users = $this->factory->user->create_many( 3 );
     555        $users = self::factory()->user->create_many( 3 );
    556556        bp_set_member_type( $users[0], 'foo' );
    557557        bp_set_member_type( $users[1], 'bar' );
     
    571571        bp_register_member_type( 'foo' );
    572572        bp_register_member_type( 'bar' );
    573         $users = $this->factory->user->create_many( 3 );
     573        $users = self::factory()->user->create_many( 3 );
    574574        bp_set_member_type( $users[0], 'foo' );
    575575        bp_set_member_type( $users[1], 'bar' );
     
    589589        bp_register_member_type( 'foo' );
    590590        bp_register_member_type( 'bar' );
    591         $users = $this->factory->user->create_many( 3 );
     591        $users = self::factory()->user->create_many( 3 );
    592592        bp_set_member_type( $users[0], 'foo' );
    593593        bp_set_member_type( $users[1], 'bar' );
     
    607607        bp_register_member_type( 'foo' );
    608608        bp_register_member_type( 'bar' );
    609         $users = $this->factory->user->create_many( 3 );
     609        $users = self::factory()->user->create_many( 3 );
    610610        bp_set_member_type( $users[0], 'foo' );
    611611        bp_set_member_type( $users[1], 'bar' );
     
    625625        bp_register_member_type( 'foo' );
    626626        bp_register_member_type( 'bar' );
    627         $users = $this->factory->user->create_many( 3 );
     627        $users = self::factory()->user->create_many( 3 );
    628628        bp_set_member_type( $users[0], 'foo' );
    629629        bp_set_member_type( $users[1], 'bar' );
     
    642642    public function test_should_return_no_results_when_no_users_match_the_specified_member_type__in() {
    643643        bp_register_member_type( 'foo' );
    644         $users = $this->factory->user->create_many( 3 );
     644        $users = self::factory()->user->create_many( 3 );
    645645
    646646        $q = new BP_User_Query( array(
     
    657657        bp_register_member_type( 'foo' );
    658658        bp_register_member_type( 'bar' );
    659         $users = $this->factory->user->create_many( 3 );
     659        $users = self::factory()->user->create_many( 3 );
    660660        bp_set_member_type( $users[0], 'foo' );
    661661        bp_set_member_type( $users[1], 'bar' );
     
    676676        bp_register_member_type( 'foo' );
    677677        bp_register_member_type( 'bar' );
    678         $users = $this->factory->user->create_many( 3 );
     678        $users = self::factory()->user->create_many( 3 );
    679679        bp_set_member_type( $users[0], 'foo' );
    680680        bp_set_member_type( $users[1], 'bar' );
     
    693693    public function test_should_return_no_results_when_all_users_match_the_specified_member_type__not_in() {
    694694        bp_register_member_type( 'foo' );
    695         $users = $this->factory->user->create_many( 3 );
     695        $users = self::factory()->user->create_many( 3 );
    696696        bp_set_member_type( $users[0], 'foo' );
    697697        bp_set_member_type( $users[1], 'foo' );
     
    710710    public function test_member_type__not_in_takes_precedence_over_member_type() {
    711711        bp_register_member_type( 'foo' );
    712         $users = $this->factory->user->create_many( 3 );
     712        $users = self::factory()->user->create_many( 3 );
    713713        bp_set_member_type( $users[0], 'foo' );
    714714        bp_set_member_type( $users[1], 'foo' );
     
    728728    public function test_member_type__not_in_takes_precedence_over_member_type__in() {
    729729        bp_register_member_type( 'foo' );
    730         $users = $this->factory->user->create_many( 3 );
     730        $users = self::factory()->user->create_many( 3 );
    731731        bp_set_member_type( $users[0], 'foo' );
    732732        bp_set_member_type( $users[1], 'foo' );
     
    748748        bp_register_member_type( 'foo' );
    749749        bp_register_member_type( 'bar' );
    750         $users = $this->factory->user->create_many( 4 );
     750        $users = self::factory()->user->create_many( 4 );
    751751        bp_set_member_type( $users[0], 'foo' );
    752752        bp_set_member_type( $users[1], 'bar' );
  • trunk/tests/phpunit/testcases/core/functions.php

    r11097 r11737  
    701701
    702702        if ( is_multisite() ) {
    703             $b = $this->factory->blog->create();
     703            $b = self::factory()->blog->create();
    704704            switch_to_blog( $b );
    705705        }
  • trunk/tests/phpunit/testcases/core/functions/bpCoreGetDirectoryPageIds.php

    r11256 r11737  
    4545        $old_page_ids = bp_core_get_directory_page_ids();
    4646
    47         $p = $this->factory->post->create( array(
     47        $p = self::factory()->post->create( array(
    4848            'post_status' => 'publish',
    4949            'post_type' => 'page',
     
    263263
    264264        // create a blog
    265         $u = $this->factory->user->create();
    266         $b1 = $this->factory->blog->create( array( 'user_id' => $u ) );
     265        $u = self::factory()->user->create();
     266        $b1 = self::factory()->blog->create( array( 'user_id' => $u ) );
    267267
    268268        // switch to blog and create some dummy posts until we reach a post ID that
    269269        // matches our BP activity page ID
    270270        switch_to_blog( $b1 );
    271         $p = $this->factory->post->create();
     271        $p = self::factory()->post->create();
    272272        while( $p <= $dir_pages->activity->id ) {
    273             $p = $this->factory->post->create();
     273            $p = self::factory()->post->create();
    274274        }
    275275
  • trunk/tests/phpunit/testcases/core/nav/backCompat.php

    r11091 r11737  
    4646     */
    4747    protected function set_up_group() {
    48         $g = $this->factory->group->create( array(
     48        $g = self::factory()->group->create( array(
    4949            'slug' => 'testgroup',
    5050        ) );
  • trunk/tests/phpunit/testcases/core/nav/bpCoreMaybeHookNewSubnavScreenFunction.php

    r11091 r11737  
    5454
    5555    public function test_user_has_access_false_user_logged_in_my_profile() {
    56         $u = $this->factory->user->create();
     56        $u = self::factory()->user->create();
    5757        $old_current_user = get_current_user_id();
    5858        $this->set_current_user( $u );
     
    7373
    7474    public function test_user_has_access_false_user_logged_in_others_profile_default_component_accessible() {
    75         $u1 = $this->factory->user->create();
    76         $u2 = $this->factory->user->create();
     75        $u1 = self::factory()->user->create();
     76        $u2 = self::factory()->user->create();
    7777        $old_current_user = get_current_user_id();
    7878        $this->set_current_user( $u1 );
     
    108108
    109109    public function test_user_has_access_false_user_logged_in_others_profile_default_component_not_accessible() {
    110         $u1 = $this->factory->user->create();
    111         $u2 = $this->factory->user->create();
     110        $u1 = self::factory()->user->create();
     111        $u2 = self::factory()->user->create();
    112112        $old_current_user = get_current_user_id();
    113113        $this->set_current_user( $u1 );
     
    144144
    145145    public function test_user_has_access_false_user_logged_in_group() {
    146         $u = $this->factory->user->create();
    147         $g = $this->factory->group->create();
     146        $u = self::factory()->user->create();
     147        $g = self::factory()->group->create();
    148148        $old_current_user = get_current_user_id();
    149149        $this->set_current_user( $u );
     
    168168
    169169    public function test_user_has_access_false_user_logged_in_group_no_redirect_url_provided() {
    170         $u = $this->factory->user->create();
    171         $g = $this->factory->group->create();
     170        $u = self::factory()->user->create();
     171        $g = self::factory()->group->create();
    172172        $old_current_user = get_current_user_id();
    173173        $this->set_current_user( $u );
  • trunk/tests/phpunit/testcases/core/nav/bpCoreNewNavItem.php

    r11091 r11737  
    1212        $bp_nav = buddypress()->bp_nav;
    1313
    14         $u = $this->factory->user->create();
     14        $u = self::factory()->user->create();
    1515        $old_current_user = get_current_user_id();
    1616        $this->set_current_user( $u );
     
    5252        $bp_nav = buddypress()->bp_nav;
    5353
    54         $u = $this->factory->user->create();
    55         $g = $this->factory->group->create();
     54        $u = self::factory()->user->create();
     55        $g = self::factory()->group->create();
    5656        $old_current_user = get_current_user_id();
    5757        $this->set_current_user( $u );
     
    143143        $bp_nav = buddypress()->bp_nav;
    144144
    145         $u = $this->factory->user->create();
    146         $u2 = $this->factory->user->create();
     145        $u = self::factory()->user->create();
     146        $u2 = self::factory()->user->create();
    147147        $old_current_user = get_current_user_id();
    148148        $this->set_current_user( $u2 );
     
    178178        $bp_nav = buddypress()->bp_nav;
    179179
    180         $u = $this->factory->user->create();
    181         $u2 = $this->factory->user->create();
     180        $u = self::factory()->user->create();
     181        $u2 = self::factory()->user->create();
    182182        $old_current_user = get_current_user_id();
    183183        $this->set_current_user( $u2 );
  • trunk/tests/phpunit/testcases/core/nav/bpCoreNewSubnavItem.php

    r10745 r11737  
    1212        $bp_options_nav = buddypress()->bp_options_nav;
    1313
    14         $u = $this->factory->user->create();
     14        $u = self::factory()->user->create();
    1515        $old_current_user = get_current_user_id();
    1616        $this->set_current_user( $u );
  • trunk/tests/phpunit/testcases/core/nav/bpCoreRemoveSubnavItem.php

    r11091 r11737  
    7373
    7474    public function test_backcompat_remove_group_nav_items() {
    75         $g1 = $this->factory->group->create();
     75        $g1 = self::factory()->group->create();
    7676
    7777        // In group context
  • trunk/tests/phpunit/testcases/core/nav/bpGetNavMenuItems.php

    r10874 r11737  
    1010     */
    1111    public function test_top_level_link_should_point_to_displayed_user_for_loggedin_user() {
    12         $users = $this->factory->user->create_many( 2 );
     12        $users = self::factory()->user->create_many( 2 );
    1313
    1414        $this->set_current_user( $users[0] );
     
    3434     */
    3535    public function test_top_level_link_should_point_to_displayed_user_for_loggedout_user() {
    36         $user = $this->factory->user->create();
     36        $user = self::factory()->user->create();
    3737
    3838        $this->set_current_user( 0 );
  • trunk/tests/phpunit/testcases/core/template/bpUserHasAccess.php

    r9989 r11737  
    66class BP_Tests_Core_Template_BpUserHasAccess extends BP_UnitTestCase {
    77    public function test_should_return_true_for_bp_moderate_user() {
    8         $users = $this->factory->user->create_many( 2 );
     8        $users = self::factory()->user->create_many( 2 );
    99
    1010        $this->grant_bp_moderate( $users[0] );
     
    1717
    1818    public function test_should_return_false_on_anothers_profile_for_user_without_bp_moderate() {
    19         $users = $this->factory->user->create_many( 2 );
     19        $users = self::factory()->user->create_many( 2 );
    2020
    2121        $this->set_current_user( $users[0] );
     
    2727
    2828    public function test_should_return_true_on_own_profile() {
    29         $users = $this->factory->user->create_many( 2 );
     29        $users = self::factory()->user->create_many( 2 );
    3030
    3131        $this->set_current_user( $users[0] );
  • 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
  • trunk/tests/phpunit/testcases/friends/class-bp-friends-friendship.php

    r11122 r11737  
    66class BP_Tests_BP_Friends_Friendship_TestCases extends BP_UnitTestCase {
    77    public function test_search_friends() {
    8         $u1 = $this->factory->user->create();
    9         $u2 = $this->factory->user->create();
    10         $u3 = $this->factory->user->create();
     8        $u1 = self::factory()->user->create();
     9        $u2 = self::factory()->user->create();
     10        $u3 = self::factory()->user->create();
    1111
    1212        xprofile_set_field_data( 1, $u2, 'Cool Dude' );
     
    2626        $this->deactivate_component( 'xprofile' );
    2727
    28         $u1 = $this->factory->user->create();
    29         $u2 = $this->factory->user->create();
    30         $u3 = $this->factory->user->create();
     28        $u1 = self::factory()->user->create();
     29        $u2 = self::factory()->user->create();
     30        $u3 = self::factory()->user->create();
    3131
    3232        add_user_meta( $u2, 'nickname', 'Cool Dude' );
     
    4141
    4242    public function test_get_bulk_last_active() {
    43         $u1 = $this->factory->user->create( array(
     43        $u1 = self::factory()->user->create( array(
    4444            'last_activity' => gmdate( 'Y-m-d H:i:s' ),
    4545        ) );
    46         $u2 = $this->factory->user->create( array(
     46        $u2 = self::factory()->user->create( array(
    4747            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
    4848        ) );
    49         $u3 = $this->factory->user->create( array(
     49        $u3 = self::factory()->user->create( array(
    5050            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
    5151        ) );
     
    5757
    5858    public function test_search_users() {
    59         $u1 = $this->factory->user->create();
    60         $u2 = $this->factory->user->create();
    61         $u3 = $this->factory->user->create();
     59        $u1 = self::factory()->user->create();
     60        $u2 = self::factory()->user->create();
     61        $u3 = self::factory()->user->create();
    6262
    6363        xprofile_set_field_data( 1, $u1, 'Freedom Isn\'t Free' );
     
    7171
    7272    public function test_search_users_count() {
    73         $u1 = $this->factory->user->create();
    74         $u2 = $this->factory->user->create();
    75         $u3 = $this->factory->user->create();
     73        $u1 = self::factory()->user->create();
     74        $u2 = self::factory()->user->create();
     75        $u3 = self::factory()->user->create();
    7676
    7777        xprofile_set_field_data( 1, $u1, 'Freedom Isn\'t Free' );
     
    8888     */
    8989    public function test_check_is_friend_not_friends() {
    90         $u1 = $this->factory->user->create();
    91         $u2 = $this->factory->user->create();
     90        $u1 = self::factory()->user->create();
     91        $u2 = self::factory()->user->create();
    9292        $this->assertEquals( 'not_friends', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) );
    9393    }
     
    9797     */
    9898    public function test_check_is_friend_pending() {
    99         $u1 = $this->factory->user->create();
    100         $u2 = $this->factory->user->create();
     99        $u1 = self::factory()->user->create();
     100        $u2 = self::factory()->user->create();
    101101        friends_add_friend( $u1, $u2, false );
    102102        $this->assertEquals( 'pending', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) );
     
    107107     */
    108108    public function test_check_is_friend_awaiting_response() {
    109         $u1 = $this->factory->user->create();
    110         $u2 = $this->factory->user->create();
     109        $u1 = self::factory()->user->create();
     110        $u2 = self::factory()->user->create();
    111111        friends_add_friend( $u1, $u2, false );
    112112        $this->assertEquals( 'awaiting_response', BP_Friends_Friendship::check_is_friend( $u2, $u1 ) );
     
    117117     */
    118118    public function test_check_is_friend_is_friend() {
    119         $u1 = $this->factory->user->create();
    120         $u2 = $this->factory->user->create();
     119        $u1 = self::factory()->user->create();
     120        $u2 = self::factory()->user->create();
    121121        friends_add_friend( $u1, $u2, true );
    122122        $this->assertEquals( 'is_friend', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) );
     
    127127     */
    128128    public function test_save_method_should_update_existing_row() {
    129         $u1 = $this->factory->user->create();
    130         $u2 = $this->factory->user->create();
     129        $u1 = self::factory()->user->create();
     130        $u2 = self::factory()->user->create();
    131131
    132132        $friendship = new BP_Friends_Friendship();
     
    155155        global $wpdb;
    156156        $now = time();
    157         $u1 = $this->factory->user->create( array(
     157        $u1 = self::factory()->user->create( array(
    158158            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    159159        ) );
    160         $u2 = $this->factory->user->create( array(
     160        $u2 = self::factory()->user->create( array(
    161161            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    162162        ) );
  • trunk/tests/phpunit/testcases/friends/functions.php

    r11354 r11737  
    2020     */
    2121    public function test_requests_on_accept() {
    22         $u1 = $this->factory->user->create();
    23         $u2 = $this->factory->user->create();
    24         $u3 = $this->factory->user->create();
     22        $u1 = self::factory()->user->create();
     23        $u2 = self::factory()->user->create();
     24        $u3 = self::factory()->user->create();
    2525
    2626        // request friendship
     
    5555     */
    5656    public function test_requests_on_request() {
    57         $u1 = $this->factory->user->create();
    58         $u2 = $this->factory->user->create();
    59         $u3 = $this->factory->user->create();
     57        $u1 = self::factory()->user->create();
     58        $u2 = self::factory()->user->create();
     59        $u3 = self::factory()->user->create();
    6060
    6161        // request friendship
     
    8585     */
    8686    public function test_requests_on_withdraw() {
    87         $u1 = $this->factory->user->create();
    88         $u2 = $this->factory->user->create();
     87        $u1 = self::factory()->user->create();
     88        $u2 = self::factory()->user->create();
    8989
    9090        // request friendship
     
    113113     */
    114114    public function test_requests_on_reject() {
    115         $u1 = $this->factory->user->create();
    116         $u2 = $this->factory->user->create();
     115        $u1 = self::factory()->user->create();
     116        $u2 = self::factory()->user->create();
    117117
    118118        // request friendship
     
    139139     */
    140140    public function test_friends_add_friend_fail_on_self() {
    141         $u1 = $this->factory->user->create();
     141        $u1 = self::factory()->user->create();
    142142        $this->assertFalse( friends_add_friend( $u1, $u1 ) );
    143143    }
     
    147147     */
    148148    public function test_friends_add_friend_already_friends() {
    149         $u1 = $this->factory->user->create();
    150         $u2 = $this->factory->user->create();
     149        $u1 = self::factory()->user->create();
     150        $u2 = self::factory()->user->create();
    151151
    152152        friends_add_friend( $u1, $u2, true );
     
    160160    public function test_friends_check_friendship_status_in_members_loop() {
    161161        $now = time();
    162         $u1 = $this->factory->user->create( array(
     162        $u1 = self::factory()->user->create( array(
    163163            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    164164        ) );
    165         $u2 = $this->factory->user->create( array(
     165        $u2 = self::factory()->user->create( array(
    166166            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    167167        ) );
    168         $u3 = $this->factory->user->create( array(
     168        $u3 = self::factory()->user->create( array(
    169169            'last_activity' => date( 'Y-m-d H:i:s', $now - 200 ),
    170170        ) );
    171         $u4 = $this->factory->user->create( array(
     171        $u4 = self::factory()->user->create( array(
    172172            'last_activity' => date( 'Y-m-d H:i:s', $now - 300 ),
    173173        ) );
    174         $u5 = $this->factory->user->create( array(
     174        $u5 = self::factory()->user->create( array(
    175175            'last_activity' => date( 'Y-m-d H:i:s', $now - 400 ),
    176176        ) );
     
    208208    public function test_friends_check_friendship_status_not_in_members_loop() {
    209209        $now = time();
    210         $u1 = $this->factory->user->create( array(
     210        $u1 = self::factory()->user->create( array(
    211211            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    212212        ) );
    213         $u2 = $this->factory->user->create( array(
     213        $u2 = self::factory()->user->create( array(
    214214            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    215215        ) );
    216         $u3 = $this->factory->user->create( array(
     216        $u3 = self::factory()->user->create( array(
    217217            'last_activity' => date( 'Y-m-d H:i:s', $now - 200 ),
    218218        ) );
    219         $u4 = $this->factory->user->create( array(
     219        $u4 = self::factory()->user->create( array(
    220220            'last_activity' => date( 'Y-m-d H:i:s', $now - 300 ),
    221221        ) );
    222         $u5 = $this->factory->user->create( array(
     222        $u5 = self::factory()->user->create( array(
    223223            'last_activity' => date( 'Y-m-d H:i:s', $now - 400 ),
    224224        ) );
     
    251251     */
    252252    public function test_friends_add_friend_friends_friendship_requested() {
    253         $u1 = $this->factory->user->create();
    254         $u2 = $this->factory->user->create();
     253        $u1 = self::factory()->user->create();
     254        $u2 = self::factory()->user->create();
    255255
    256256        add_filter( 'friends_friendship_requested', array( $this, 'friends_friendship_filter_callback' ) );
     
    265265     */
    266266    public function test_friends_add_friend_friends_friendship_accepted() {
    267         $u1 = $this->factory->user->create();
    268         $u2 = $this->factory->user->create();
     267        $u1 = self::factory()->user->create();
     268        $u2 = self::factory()->user->create();
    269269
    270270        add_filter( 'friends_friendship_accepted', array( $this, 'friends_friendship_filter_callback' ) );
     
    286286        global $wpdb;
    287287        $now = time();
    288         $u1 = $this->factory->user->create( array(
     288        $u1 = self::factory()->user->create( array(
    289289            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    290290        ) );
    291         $u2 = $this->factory->user->create( array(
     291        $u2 = self::factory()->user->create( array(
    292292            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    293293        ) );
    294         $u3 = $this->factory->user->create( array(
     294        $u3 = self::factory()->user->create( array(
    295295            'last_activity' => date( 'Y-m-d H:i:s', $now - 200 ),
    296296        ) );
     
    313313        global $wpdb;
    314314        $now = time();
    315         $u1 = $this->factory->user->create( array(
     315        $u1 = self::factory()->user->create( array(
    316316            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    317317        ) );
    318         $u2 = $this->factory->user->create( array(
     318        $u2 = self::factory()->user->create( array(
    319319            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    320320        ) );
     
    335335
    336336    public function test_friends_get_recently_active() {
    337         $u1 = $this->factory->user->create();
    338         $u2 = $this->factory->user->create();
    339         $u3 = $this->factory->user->create();
    340         $u4 = $this->factory->user->create();
     337        $u1 = self::factory()->user->create();
     338        $u2 = self::factory()->user->create();
     339        $u3 = self::factory()->user->create();
     340        $u4 = self::factory()->user->create();
    341341
    342342        // request friendship
     
    357357
    358358    public function test_friends_get_alphabetically() {
    359         $u1 = $this->factory->user->create();
    360         $u2 = $this->factory->user->create();
    361         $u3 = $this->factory->user->create();
     359        $u1 = self::factory()->user->create();
     360        $u2 = self::factory()->user->create();
     361        $u3 = self::factory()->user->create();
    362362
    363363        // request friendship
     
    378378
    379379    public function test_friends_get_newest() {
    380         $u1 = $this->factory->user->create();
    381         $u2 = $this->factory->user->create();
    382         $u3 = $this->factory->user->create();
    383         $u4 = $this->factory->user->create();
     380        $u1 = self::factory()->user->create();
     381        $u2 = self::factory()->user->create();
     382        $u3 = self::factory()->user->create();
     383        $u4 = self::factory()->user->create();
    384384
    385385        // request friendship
  • trunk/tests/phpunit/testcases/friends/notifications.php

    r9819 r11737  
    1212        parent::setUp();
    1313        $this->current_user = get_current_user_id();
    14         $this->set_current_user( $this->factory->user->create() );
     14        $this->set_current_user( self::factory()->user->create() );
    1515
    16         $this->friend = $this->factory->user->create();
     16        $this->friend = self::factory()->user->create();
    1717        $this->filter_fired = '';
    1818    }
  • trunk/tests/phpunit/testcases/groups/activity.php

    r11557 r11737  
    1111     */
    1212    public function test_bp_groups_format_activity_action_created_group() {
    13         $u = $this->factory->user->create();
    14         $g = $this->factory->group->create();
    15         $a = $this->factory->activity->create( array(
     13        $u = self::factory()->user->create();
     14        $g = self::factory()->group->create();
     15        $a = self::factory()->activity->create( array(
    1616            'component' => buddypress()->groups->id,
    1717            'type' => 'created_group',
     
    3333     */
    3434    public function test_bp_groups_format_activity_action_joined_group() {
    35         $u = $this->factory->user->create();
    36         $g = $this->factory->group->create();
    37         $a = $this->factory->activity->create( array(
     35        $u = self::factory()->user->create();
     36        $g = self::factory()->group->create();
     37        $a = self::factory()->activity->create( array(
    3838            'component' => buddypress()->groups->id,
    3939            'type' => 'joined_group',
     
    5555     */
    5656    public function test_bp_groups_format_activity_action_group_details_updated_with_no_change() {
    57         $group = $this->factory->group->create_and_get();
     57        $group = self::factory()->group->create_and_get();
    5858        groups_edit_base_group_details( array(
    5959                'group_id'       => $group->id,
     
    7878     */
    7979    public function test_bp_groups_format_activity_action_group_details_updated_with_notify_members_false() {
    80         $group = $this->factory->group->create_and_get();
     80        $group = self::factory()->group->create_and_get();
    8181        groups_edit_base_group_details( array(
    8282            'group_id'       => $group->id,
     
    102102    public function test_bp_groups_format_activity_action_group_details_updated_with_updated_name() {
    103103        $old_user = get_current_user_id();
    104         $u = $this->factory->user->create();
    105         $this->set_current_user( $u );
    106 
    107         $group = $this->factory->group->create_and_get();
     104        $u = self::factory()->user->create();
     105        $this->set_current_user( $u );
     106
     107        $group = self::factory()->group->create_and_get();
    108108        groups_edit_base_group_details( array(
    109109            'group_id'       => $group->id,
     
    134134    public function test_bp_groups_format_activity_action_group_details_updated_with_updated_description() {
    135135        $old_user = get_current_user_id();
    136         $u = $this->factory->user->create();
    137         $this->set_current_user( $u );
    138 
    139         $group = $this->factory->group->create_and_get();
     136        $u = self::factory()->user->create();
     137        $this->set_current_user( $u );
     138
     139        $group = self::factory()->group->create_and_get();
    140140        groups_edit_base_group_details( array(
    141141            'group_id'       => $group->id,
     
    166166    public function test_bp_groups_format_activity_action_group_details_updated_with_updated_slug() {
    167167        $old_user = get_current_user_id();
    168         $u = $this->factory->user->create();
    169         $this->set_current_user( $u );
    170 
    171         $group = $this->factory->group->create_and_get();
     168        $u = self::factory()->user->create();
     169        $this->set_current_user( $u );
     170
     171        $group = self::factory()->group->create_and_get();
    172172        groups_edit_base_group_details( array(
    173173            'group_id'       => $group->id,
     
    199199    public function test_bp_groups_format_activity_action_group_details_updated_with_updated_name_and_description() {
    200200        $old_user = get_current_user_id();
    201         $u = $this->factory->user->create();
    202         $this->set_current_user( $u );
    203 
    204         $group = $this->factory->group->create_and_get();
     201        $u = self::factory()->user->create();
     202        $this->set_current_user( $u );
     203
     204        $group = self::factory()->group->create_and_get();
    205205        groups_edit_base_group_details( array(
    206206            'group_id'       => $group->id,
  • trunk/tests/phpunit/testcases/groups/avatars.php

    r9819 r11737  
    1010     */
    1111    public function test_bp_get_group_has_avatar_no_avatar_uploaded() {
    12         $g = $this->factory->group->create();
     12        $g = self::factory()->group->create();
    1313        $this->assertFalse( bp_get_group_has_avatar( $g ) );
    1414    }
     
    1818     */
    1919    public function test_bp_get_group_has_avatar_has_avatar_uploaded() {
    20         $g = $this->factory->group->create();
     20        $g = self::factory()->group->create();
    2121
    2222        // Fake it
  • trunk/tests/phpunit/testcases/groups/cache.php

    r11091 r11737  
    1010     */
    1111    public function test_bp_groups_update_meta_cache() {
    12         $g1 = $this->factory->group->create();
    13         $g2 = $this->factory->group->create();
     12        $g1 = self::factory()->group->create();
     13        $g2 = self::factory()->group->create();
    1414
    1515        $time = bp_core_current_time();
     
    7171     */
    7272    public function test_bp_groups_delete_group_cache_on_metadata_add() {
    73         $g = $this->factory->group->create();
     73        $g = self::factory()->group->create();
    7474
    7575        // Prime cache
     
    8989     */
    9090    public function test_bp_groups_delete_group_cache_on_metadata_change() {
    91         $g = $this->factory->group->create();
     91        $g = self::factory()->group->create();
    9292
    9393        // Prime cache
     
    106106     */
    107107    public function test_bp_groups_prefetch_activity_object_data_all_cached() {
    108         $g = $this->factory->group->create();
     108        $g = self::factory()->group->create();
    109109
    110110        // Prime cache
     
    130130     */
    131131    public function test_bp_groups_prefetch_activity_object_data_some_cached() {
    132         $g1 = $this->factory->group->create();
    133         $g2 = $this->factory->group->create();
     132        $g1 = self::factory()->group->create();
     133        $g2 = self::factory()->group->create();
    134134
    135135        // Prime cache
     
    160160     */
    161161    public function test_groups_get_group_admins_cache() {
    162         $u1 = $this->factory->user->create();
    163         $u2 = $this->factory->user->create();
    164         $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
     162        $u1 = self::factory()->user->create();
     163        $u2 = self::factory()->user->create();
     164        $g = self::factory()->group->create( array( 'creator_id' => $u1 ) );
    165165
    166166        // User 2 joins the group
     
    185185     */
    186186    public function test_groups_get_group_mods_cache() {
    187         $u1 = $this->factory->user->create();
    188         $u2 = $this->factory->user->create();
    189         $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
     187        $u1 = self::factory()->user->create();
     188        $u2 = self::factory()->user->create();
     189        $g = self::factory()->group->create( array( 'creator_id' => $u1 ) );
    190190
    191191        // User 2 joins the group
     
    207207     */
    208208    public function test_groups_get_group_mods_cache_on_member_save() {
    209         $u1 = $this->factory->user->create();
    210         $u2 = $this->factory->user->create();
    211         $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
     209        $u1 = self::factory()->user->create();
     210        $u2 = self::factory()->user->create();
     211        $g = self::factory()->group->create( array( 'creator_id' => $u1 ) );
    212212
    213213        // prime cache
     
    225225     */
    226226    public function test_groups_get_group_admins_cache_on_member_save() {
    227         $u1 = $this->factory->user->create();
    228         $u2 = $this->factory->user->create();
    229         $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
     227        $u1 = self::factory()->user->create();
     228        $u2 = self::factory()->user->create();
     229        $g = self::factory()->group->create( array( 'creator_id' => $u1 ) );
    230230
    231231        // prime cache
  • trunk/tests/phpunit/testcases/groups/class-bp-group-extension.php

    r11091 r11737  
    223223        $old_options_nav = buddypress()->bp_options_nav;
    224224
    225         $g = $this->factory->group->create();
     225        $g = self::factory()->group->create();
    226226        $g_obj = groups_get_group( $g );
    227227
     
    246246        $old_options_nav = buddypress()->bp_options_nav;
    247247
    248         $g = $this->factory->group->create();
     248        $g = self::factory()->group->create();
    249249        $g_obj = groups_get_group( $g );
    250250
     
    270270        $old_current_user = get_current_user_id();
    271271
    272         $g = $this->factory->group->create( array(
     272        $g = self::factory()->group->create( array(
    273273            'status' => 'private',
    274274        ) );
     
    288288
    289289        // Test as group member
    290         $u = $this->factory->user->create();
     290        $u = self::factory()->user->create();
    291291        $this->set_current_user( $u );
    292292        $this->add_user_to_group( $u, $g );
     
    314314        $old_current_user = get_current_user_id();
    315315
    316         $g = $this->factory->group->create( array(
     316        $g = self::factory()->group->create( array(
    317317            'status' => 'private',
    318318        ) );
     
    332332
    333333        // Test as group member
    334         $u = $this->factory->user->create();
     334        $u = self::factory()->user->create();
    335335        $this->set_current_user( $u );
    336336        $this->add_user_to_group( $u, $g );
     
    350350        $old_current_user = get_current_user_id();
    351351
    352         $g = $this->factory->group->create( array(
     352        $g = self::factory()->group->create( array(
    353353            'status' => 'public',
    354354        ) );
     
    376376        $this->set_current_user( 0 );
    377377
    378         $g = $this->factory->group->create( array(
     378        $g = self::factory()->group->create( array(
    379379            'status' => 'public',
    380380        ) );
     
    413413     */
    414414    public function test_user_can_visit_explicit_for_logged_in_user() {
    415         $g = $this->factory->group->create( array(
    416             'status' => 'public',
    417         ) );
    418         $g_obj = groups_get_group( $g );
    419 
    420         $u = $this->factory->user->create();
     415        $g = self::factory()->group->create( array(
     416            'status' => 'public',
     417        ) );
     418        $g_obj = groups_get_group( $g );
     419
     420        $u = self::factory()->user->create();
    421421        $old_current_user = get_current_user_id();
    422422        $this->set_current_user( $u );
     
    455455     */
    456456    public function test_user_can_visit_explicit_for_group_member() {
    457         $g = $this->factory->group->create( array(
    458             'status' => 'public',
    459         ) );
    460         $g_obj = groups_get_group( $g );
    461 
    462         $u = $this->factory->user->create();
     457        $g = self::factory()->group->create( array(
     458            'status' => 'public',
     459        ) );
     460        $g_obj = groups_get_group( $g );
     461
     462        $u = self::factory()->user->create();
    463463        $old_current_user = get_current_user_id();
    464464        $this->set_current_user( $u );
     
    499499     */
    500500    public function test_user_can_visit_explicit_for_group_mod() {
    501         $g = $this->factory->group->create( array(
    502             'status' => 'public',
    503         ) );
    504         $g_obj = groups_get_group( $g );
    505 
    506         $u = $this->factory->user->create();
     501        $g = self::factory()->group->create( array(
     502            'status' => 'public',
     503        ) );
     504        $g_obj = groups_get_group( $g );
     505
     506        $u = self::factory()->user->create();
    507507        $old_current_user = get_current_user_id();
    508508        $this->set_current_user( $u );
     
    545545     */
    546546    public function test_user_can_visit_explicit_for_group_admin() {
    547         $g = $this->factory->group->create( array(
    548             'status' => 'public',
    549         ) );
    550         $g_obj = groups_get_group( $g );
    551 
    552         $u = $this->factory->user->create();
     547        $g = self::factory()->group->create( array(
     548            'status' => 'public',
     549        ) );
     550        $g_obj = groups_get_group( $g );
     551
     552        $u = self::factory()->user->create();
    553553        $old_current_user = get_current_user_id();
    554554        $this->set_current_user( $u );
     
    591591     */
    592592    public function test_user_can_see_nav_item_implied() {
    593         $g = $this->factory->group->create( array(
     593        $g = self::factory()->group->create( array(
    594594            'status' => 'public',
    595595        ) );
     
    632632     */
    633633    public function test_user_can_see_nav_item_explicit_for_logged_out_user() {
    634         $g = $this->factory->group->create( array(
     634        $g = self::factory()->group->create( array(
    635635            'status' => 'public',
    636636        ) );
     
    673673     */
    674674    public function test_user_can_see_nav_item_explicit_for_logged_in_user() {
    675         $g = $this->factory->group->create( array(
    676             'status' => 'public',
    677         ) );
    678         $g_obj = groups_get_group( $g );
    679 
    680         $u = $this->factory->user->create();
     675        $g = self::factory()->group->create( array(
     676            'status' => 'public',
     677        ) );
     678        $g_obj = groups_get_group( $g );
     679
     680        $u = self::factory()->user->create();
    681681        $old_current_user = get_current_user_id();
    682682        $this->set_current_user( $u );
     
    715715     */
    716716    public function test_user_can_see_nav_item_explicit_for_group_member() {
    717         $g = $this->factory->group->create( array(
    718       &