Skip to:
Content

bbPress.org

Changeset 6110


Ignore:
Timestamp:
11/02/2016 05:22:08 AM (5 years ago)
Author:
netweb
Message:

Tests: Use assertEqualSets() instead of assertEquals() in favorites and subscriptions tests.

This changeset improves array comparisons where arrays may not be in the same order.

See #2959.

Location:
trunk/tests/phpunit/testcases/users/functions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/users/functions/favorites.php

    r6109 r6110  
    2424        $favoriters = bbp_get_topic_favoriters( $t );
    2525
    26         $this->assertEquals( $expected, $favoriters );
     26        $this->assertEqualSets( $expected, $favoriters );
    2727
    2828        // Add topic favorites.
     
    3232        $favoriters = bbp_get_topic_favoriters( $t );
    3333
    34         $this->assertEquals( $expected, $favoriters );
     34        $this->assertEqualSets( $expected, $favoriters );
    3535
    3636        // Remove user favorite.
     
    4040        $favoriters = bbp_get_topic_favoriters( $t );
    4141
    42         $this->assertEquals( $expected, $favoriters );
     42        $this->assertEqualSets( $expected, $favoriters );
    4343    }
    4444
     
    8383        $favorites = bbp_get_user_favorites_topic_ids( $u );
    8484
    85         $this->assertEquals( array( $t[0], $t[1], $t[2] ), $favorites );
     85        $this->assertEqualSets( array( $t[0], $t[1], $t[2] ), $favorites );
    8686
    8787        // Remove user favorite.
     
    9090        $favorites = bbp_get_user_favorites_topic_ids( $u );
    9191
    92         $this->assertEquals( array( $t[0], $t[2] ), $favorites );
     92        $this->assertEqualSets( array( $t[0], $t[2] ), $favorites );
    9393    }
    9494
     
    127127        $favorites = bbp_get_user_favorites_topic_ids( $u );
    128128
    129         $this->assertEquals( array( $t[0], $t[1] ), $favorites );
     129        $this->assertEqualSets( array( $t[0], $t[1] ), $favorites );
    130130
    131131        // Add user favorite.
     
    134134        $favorites = bbp_get_user_favorites_topic_ids( $u );
    135135
    136         $this->assertEquals( array( $t[0], $t[1], $t[2] ), $favorites );
     136        $this->assertEqualSets( array( $t[0], $t[1], $t[2] ), $favorites );
    137137    }
    138138
     
    154154        $favorites = bbp_get_user_favorites_topic_ids( $u );
    155155
    156         $this->assertEquals( array( $t[0], $t[1] ), $favorites );
     156        $this->assertEqualSets( array( $t[0], $t[1] ), $favorites );
    157157
    158158        // Remove user favorite.
     
    161161        $favorites = bbp_get_user_favorites_topic_ids( $u );
    162162
    163         $this->assertEquals( array( $t[0] ), $favorites );
     163        $this->assertEqualSets( array( $t[0] ), $favorites );
    164164    }
    165165
  • trunk/tests/phpunit/testcases/users/functions/subscriptions.php

    r5928 r6110  
    2424        $subscribers = bbp_get_forum_subscribers( $f[0] );
    2525
    26         $this->assertEquals( array( $u[0], $u[1], $u[2] ), $subscribers );
     26        $this->assertEqualSets( array( $u[0], $u[1], $u[2] ), $subscribers );
    2727
    2828        // Add forum subscriptions.
     
    3232        $subscribers = bbp_get_forum_subscribers( $f[1] );
    3333
    34         $this->assertEquals( array( $u[0], $u[2] ), $subscribers );
     34        $this->assertEqualSets( array( $u[0], $u[2] ), $subscribers );
    3535    }
    3636
     
    4949        $subscribers = bbp_get_topic_subscribers( $t[0] );
    5050
    51         $this->assertEquals( array( $u[0], $u[1], $u[2] ), $subscribers );
     51        $this->assertEqualSets( array( $u[0], $u[1], $u[2] ), $subscribers );
    5252
    5353        // Add topic subscriptions.
     
    5757        $subscribers = bbp_get_topic_subscribers( $t[1] );
    5858
    59         $this->assertEquals( array( $u[0], $u[2] ), $subscribers );
     59        $this->assertEqualSets( array( $u[0], $u[2] ), $subscribers );
    6060    }
    6161
     
    153153        $subscriptions = bbp_get_user_subscribed_forum_ids( $u );
    154154
    155         $this->assertEquals( array( $f[0], $f[1], $f[2] ), $subscriptions );
     155        $this->assertEqualSets( array( $f[0], $f[1], $f[2] ), $subscriptions );
    156156
    157157        // Remove forum subscription.
     
    160160        $subscriptions = bbp_get_user_subscribed_forum_ids( $u );
    161161
    162         $this->assertEquals( array( $f[0], $f[2] ), $subscriptions );
     162        $this->assertEqualSets( array( $f[0], $f[2] ), $subscriptions );
    163163    }
    164164
     
    177177        $subscriptions = bbp_get_user_subscribed_topic_ids( $u );
    178178
    179         $this->assertEquals( array( $t[0], $t[1], $t[2] ), $subscriptions );
     179        $this->assertEqualSets( array( $t[0], $t[1], $t[2] ), $subscriptions );
    180180
    181181        // Remove topic subscription.
     
    184184        $subscriptions = bbp_get_user_subscribed_topic_ids( $u );
    185185
    186         $this->assertEquals( array( $t[0], $t[2] ), $subscriptions );
     186        $this->assertEqualSets( array( $t[0], $t[2] ), $subscriptions );
    187187    }
    188188
Note: See TracChangeset for help on using the changeset viewer.