[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/tests/phpunit/testcases/testsuite/ -> factory.php (source)

   1  <?php
   2  
   3  /**
   4   * @group testsuite
   5   */
   6  class BPTests_Testsuite_Factory extends BP_UnitTestCase {
   7      /**
   8       * @ticket BP7234
   9       */
  10      public function test_message_create_and_get_should_return_message_object() {
  11          $m = self::factory()->message->create_and_get();
  12  
  13          $this->assertTrue( $m instanceof BP_Messages_Message );
  14      }
  15  
  16      /**
  17       * @ticket BP7234
  18       */
  19      public function test_message_should_create_default_sender_and_recipient() {
  20          $m = self::factory()->message->create_and_get();
  21  
  22          $this->assertNotEmpty( $m->sender_id );
  23          $this->assertNotEmpty( $m->get_recipients() );
  24      }
  25  
  26      /**
  27       * @ticket BP7243
  28       */
  29      public function test_friendship_should_create_default_initiator_and_friend() {
  30          $f = self::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 = self::factory()->user->create();
  44          $u2 = self::factory()->user->create();
  45  
  46          $f = self::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      }
  54  }


Generated: Mon Sep 21 01:01:31 2020 Cross-referenced by PHPXref 0.7.1