You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tests: Replace assertEquals() with assertSameSets() in text widget tests.
This ensures that not only the array values being compared are equal, but also that their type is the same.
Going forward, stricter type checking by using `assertSame()`, `assertSameSets()`, or `assertSameSetsWithIndex()` should generally be preferred, to make the tests more reliable.
Follow-up to [40631], [41132], [48939], [51137].
See #52482, #52625.
git-svn-id: https://develop.svn.wordpress.org/trunk@51220 602fd350-edb4-49c9-b593-d223f7449a82
$this->assertSame( $expected, $result, 'Updating a pre-existing widget with visual mode forces filter to be true.' );
798
+
$this->assertSameSets( $expected, $result, 'Updating a pre-existing widget with visual mode forces filter to be true.' );
799
799
800
800
// --
801
801
$instance = array(
@@ -816,7 +816,7 @@ function test_update_legacy() {
816
816
'visual' => true,
817
817
)
818
818
);
819
-
$this->assertSame( $expected, $result, 'Updating a pre-existing visual widget retains visual mode when updated.' );
819
+
$this->assertSameSets( $expected, $result, 'Updating a pre-existing visual widget retains visual mode when updated.' );
820
820
821
821
// --
822
822
$instance = array(
@@ -837,7 +837,7 @@ function test_update_legacy() {
837
837
'filter' => true,
838
838
)
839
839
);
840
-
$this->assertSame( $expected, $result, 'Updating a pre-existing visual widget retains visual=true and supplies missing filter=true.' );
840
+
$this->assertSameSets( $expected, $result, 'Updating a pre-existing visual widget retains visual=true and supplies missing filter=true.' );
841
841
842
842
// --
843
843
$instance = array(
@@ -852,7 +852,7 @@ function test_update_legacy() {
852
852
)
853
853
);
854
854
$result = $widget->update( $instance, array() );
855
-
$this->assertEquals( $expected, $result, 'Updating a widget with explicit visual=true and absent filter prop causes filter to be set to true.' );
855
+
$this->assertSameSets( $expected, $result, 'Updating a widget with explicit visual=true and absent filter prop causes filter to be set to true.' );
856
856
857
857
// --
858
858
$instance = array(
@@ -867,7 +867,7 @@ function test_update_legacy() {
867
867
'filter' => false,
868
868
)
869
869
);
870
-
$this->assertEquals( $expected, $result, 'Updating a widget in legacy mode results in filter=false as if checkbox not checked.' );
870
+
$this->assertSameSets( $expected, $result, 'Updating a widget in legacy mode results in filter=false as if checkbox not checked.' );
871
871
872
872
// --
873
873
$instance = array(
@@ -890,7 +890,7 @@ function test_update_legacy() {
890
890
'filter' => false,
891
891
)
892
892
);
893
-
$this->assertSame( $expected, $result, 'Updating a widget that previously had legacy form results in filter allowed to be false.' );
893
+
$this->assertSameSets( $expected, $result, 'Updating a widget that previously had legacy form results in filter allowed to be false.' );
894
894
895
895
// --
896
896
$instance = array(
@@ -906,7 +906,7 @@ function test_update_legacy() {
906
906
'visual' => true,
907
907
)
908
908
);
909
-
$this->assertSame( $expected, $result, 'Updating a widget that had \'content\' as its filter value persists non-legacy mode. This only existed in WP 4.8.0.' );
909
+
$this->assertSameSets( $expected, $result, 'Updating a widget that had \'content\' as its filter value persists non-legacy mode. This only existed in WP 4.8.0.' );
910
910
911
911
// --
912
912
$instance = array(
@@ -927,7 +927,7 @@ function test_update_legacy() {
927
927
'filter' => true,
928
928
)
929
929
);
930
-
$this->assertEquals( $expected, $result, 'Updating a pre-existing widget with the filter=content prop in WP 4.8.0 upgrades to filter=true&visual=true.' );
930
+
$this->assertSameSets( $expected, $result, 'Updating a pre-existing widget with the filter=content prop in WP 4.8.0 upgrades to filter=true&visual=true.' );
931
931
932
932
// --
933
933
$instance = array(
@@ -943,7 +943,7 @@ function test_update_legacy() {
943
943
'visual' => true,
944
944
)
945
945
);
946
-
$this->assertSame( $expected, $result, 'Updating a widget with filter=content (from WP 4.8.0) upgrades to filter=true&visual=true.' );
946
+
$this->assertSameSets( $expected, $result, 'Updating a widget with filter=content (from WP 4.8.0) upgrades to filter=true&visual=true.' );
0 commit comments