Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/02/2016 05:22:08 AM (9 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.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.