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/messages/template.php

    r11044 r11737  
    1010     */
    1111    public function test_has_message_threads() {
    12         $u1 = $this->factory->user->create();
    13         $u2 = $this->factory->user->create();
     12        $u1 = self::factory()->user->create();
     13        $u2 = self::factory()->user->create();
    1414
    1515        // create initial thread
    16         $message_1 = $this->factory->message->create_and_get( array(
     16        $message_1 = self::factory()->message->create_and_get( array(
    1717            'sender_id'  => $u1,
    1818            'recipients' => array( $u2 ),
     
    2020
    2121        // create some replies to thread
    22         $message_2 = $this->factory->message->create_and_get( array(
     22        $message_2 = self::factory()->message->create_and_get( array(
    2323            'thread_id' => $message_1->thread_id,
    2424            'sender_id' => $u2,
    2525            'recipients' => array( $u1 ),
    2626        ) );
    27         $message_3 = $this->factory->message->create_and_get( array(
     27        $message_3 = self::factory()->message->create_and_get( array(
    2828            'thread_id' => $message_1->thread_id,
    2929            'sender_id' => $u2,
     
    4343     */
    4444    public function test_has_message_threads_old_args() {
    45         $u1 = $this->factory->user->create();
    46         $u2 = $this->factory->user->create();
     45        $u1 = self::factory()->user->create();
     46        $u2 = self::factory()->user->create();
    4747
    4848        // create initial thread
    49         $message_1 = $this->factory->message->create_and_get( array(
     49        $message_1 = self::factory()->message->create_and_get( array(
    5050            'sender_id'  => $u1,
    5151            'recipients' => array( $u2 ),
     
    5353
    5454        // create some replies to thread
    55         $message_2 = $this->factory->message->create_and_get( array(
     55        $message_2 = self::factory()->message->create_and_get( array(
    5656            'thread_id' => $message_1->thread_id,
    5757            'sender_id' => $u2,
    5858            'recipients' => array( $u1 ),
    5959        ) );
    60         $message_3 = $this->factory->message->create_and_get( array(
     60        $message_3 = self::factory()->message->create_and_get( array(
    6161            'thread_id' => $message_1->thread_id,
    6262            'sender_id' => $u2,
     
    7575     */
    7676    public function test_thread_has_messages_meta_query() {
    77         $u1 = $this->factory->user->create();
    78         $u2 = $this->factory->user->create();
     77        $u1 = self::factory()->user->create();
     78        $u2 = self::factory()->user->create();
    7979
    8080        // create some threads
    81         $message_1 = $this->factory->message->create_and_get( array(
     81        $message_1 = self::factory()->message->create_and_get( array(
    8282            'sender_id'  => $u1,
    8383            'recipients' => array( $u2 ),
    8484            'subject'    => 'This is a knive',
    8585        ) );
    86         $message_2 = $this->factory->message->create_and_get( array(
     86        $message_2 = self::factory()->message->create_and_get( array(
    8787            'sender_id'  => $u1,
    8888            'recipients' => array( $u2 ),
     
    9191
    9292        // misc threads
    93         $this->factory->message->create_many( 3, array(
     93        self::factory()->message->create_many( 3, array(
    9494            'sender_id'  => $u1,
    9595            'recipients' => array( $u2 ),
     
    100100
    101101        // create some replies for thread 1
    102         $message_3 = $this->factory->message->create_and_get( array(
     102        $message_3 = self::factory()->message->create_and_get( array(
    103103            'thread_id'  => $t1,
    104104            'sender_id'  => $u2,
     
    106106            'content'    => "That's a spoon",
    107107        ) );
    108         $message_4 = $this->factory->message->create_and_get( array(
     108        $message_4 = self::factory()->message->create_and_get( array(
    109109            'thread_id'  => $t1,
    110110            'sender_id'  => $u1,
     
    112112            'content'    => "I see you've played knivey-spooney before.",
    113113        ) );
    114         $message_5 = $this->factory->message->create_and_get( array(
     114        $message_5 = self::factory()->message->create_and_get( array(
    115115            'thread_id'  => $t1,
    116116            'sender_id'  => $u2,
     
    120120
    121121        // create some replies for thread 2
    122         $message_6 = $this->factory->message->create_and_get( array(
     122        $message_6 = self::factory()->message->create_and_get( array(
    123123            'thread_id'  => $t2,
    124124            'sender_id'  => $u2,
     
    170170     */
    171171    public function test_thread_has_messages_meta_query_multiple_clauses_relation_and() {
    172         $u1 = $this->factory->user->create();
    173         $u2 = $this->factory->user->create();
     172        $u1 = self::factory()->user->create();
     173        $u2 = self::factory()->user->create();
    174174
    175175        // create some threads
    176         $message_1 = $this->factory->message->create_and_get( array(
     176        $message_1 = self::factory()->message->create_and_get( array(
    177177            'sender_id'  => $u1,
    178178            'recipients' => array( $u2 ),
    179179            'subject'    => 'This is a knive',
    180180        ) );
    181         $message_2 = $this->factory->message->create_and_get( array(
     181        $message_2 = self::factory()->message->create_and_get( array(
    182182            'sender_id'  => $u1,
    183183            'recipients' => array( $u2 ),
     
    186186
    187187        // misc threads
    188         $this->factory->message->create_many( 3, array(
     188        self::factory()->message->create_many( 3, array(
    189189            'sender_id'  => $u1,
    190190            'recipients' => array( $u2 ),
     
    195195
    196196        // create some replies for thread 1
    197         $message_3 = $this->factory->message->create_and_get( array(
     197        $message_3 = self::factory()->message->create_and_get( array(
    198198            'thread_id'  => $t1,
    199199            'sender_id'  => $u2,
     
    201201            'content'    => "That's a spoon",
    202202        ) );
    203         $message_4 = $this->factory->message->create_and_get( array(
     203        $message_4 = self::factory()->message->create_and_get( array(
    204204            'thread_id'  => $t1,
    205205            'sender_id'  => $u1,
     
    207207            'content'    => "I see you've played knivey-spooney before.",
    208208        ) );
    209         $message_5 = $this->factory->message->create_and_get( array(
     209        $message_5 = self::factory()->message->create_and_get( array(
    210210            'thread_id'  => $t1,
    211211            'sender_id'  => $u2,
     
    215215
    216216        // create some replies for thread 2
    217         $message_6 = $this->factory->message->create_and_get( array(
     217        $message_6 = self::factory()->message->create_and_get( array(
    218218            'thread_id'  => $t2,
    219219            'sender_id'  => $u2,
     
    269269     */
    270270    public function test_has_message_threads_anonymous_user_should_not_see_threads() {
    271         $u1 = $this->factory->user->create();
    272         $u2 = $this->factory->user->create();
     271        $u1 = self::factory()->user->create();
     272        $u2 = self::factory()->user->create();
    273273
    274274        // create initial thread
    275         $this->factory->message->create( array(
     275        self::factory()->message->create( array(
    276276            'sender_id'  => $u1,
    277277            'recipients' => array( $u2 ),
Note: See TracChangeset for help on using the changeset viewer.