WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/04/2020 07:01:00 AM (17 months ago)
Author:
SergeyBiryukov
Message:

Tests: Introduce assertSameSets() and assertSameSetsWithIndex(), and use them where appropriate.

This ensures that not only the array values being compared are equal, but also that their type is the same.

These new methods replace most of the existing instances of assertEqualSets() and assertEqualSetsWithIndex().

Going forward, stricter type checking by using assertSameSets() or assertSameSetsWithIndex() should generally be preferred, to make the tests more reliable.

Follow-up to [48937].

See #38266.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/WPTheme.php

    r48937 r48939  
    166166        $current_allowed_themes['testtheme-1'] = true; // Add the new theme to the previous set.
    167167
    168         $this->assertEqualSetsWithIndex( $current_allowed_themes, $new_allowed_themes );
     168        $this->assertSameSetsWithIndex( $current_allowed_themes, $new_allowed_themes );
    169169    }
    170170
     
    189189        );
    190190
    191         $this->assertEqualSetsWithIndex( $current_allowed_themes, $new_allowed_themes );
     191        $this->assertSameSetsWithIndex( $current_allowed_themes, $new_allowed_themes );
    192192    }
    193193
     
    214214        unset( $allowed_themes[ $disable_theme ] ); // Remove deleted theme from initial set.
    215215
    216         $this->assertEqualSetsWithIndex( $allowed_themes, $new_allowed_themes );
     216        $this->assertSameSetsWithIndex( $allowed_themes, $new_allowed_themes );
    217217    }
    218218
     
    240240        unset( $allowed_themes['existing-5'] );
    241241
    242         $this->assertEqualSetsWithIndex( $allowed_themes, $new_allowed_themes );
     242        $this->assertSameSetsWithIndex( $allowed_themes, $new_allowed_themes );
    243243    }
    244244}
Note: See TracChangeset for help on using the changeset viewer.