Skip to:
Content

BuddyPress.org


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

Use static factory method throughout PHPUnit tests.

See #7620.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/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.
Note: See TracChangeset for help on using the changeset viewer.