Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/06/2016 03:31:21 AM (10 years ago)
Author:
boonebgorges
Message:

Tests: Add Friendship factory.

Props jdgrimes.
Fixes #7243.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/testsuite/factory.php

    r11042 r11063  
    2323                $this->assertNotEmpty( $m->get_recipients() );
    2424        }
     25
     26        /**
     27         * @ticket BP7243
     28         */
     29        public function test_friendship_should_create_default_initiator_and_friend() {
     30                $f = $this->factory->friendship->create_and_get();
     31
     32                $u1 = new WP_User( $f->initiator_user_id );
     33                $u2 = new WP_User( $f->friend_user_id );
     34
     35                $this->assertTrue( $u1->exists() );
     36                $this->assertTrue( $u2->exists() );
     37        }
     38
     39        /**
     40         * @ticket BP7243
     41         */
     42        public function test_friendship_should_respect_passed_initiator_and_friend() {
     43                $u1 = $this->factory->user->create();
     44                $u2 = $this->factory->user->create();
     45
     46                $f = $this->factory->friendship->create_and_get( array(
     47                        'initiator_user_id' => $u1,
     48                        'friend_user_id' => $u2,
     49                ) );
     50
     51                $this->assertSame( $u1, $f->initiator_user_id );
     52                $this->assertSame( $u2, $f->friend_user_id );
     53        }
    2554}
Note: See TracChangeset for help on using the changeset viewer.