From ea4bedee9dc75b5e03f8bcb86de00f4ef12babd1 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Wed, 30 Mar 2022 13:08:51 -0400 Subject: [PATCH] Remove misleading test in SerializationTestTrain::validateObjectEquality() The initial object comparison using `==` compares all the property values using `==` as well. This causes (for example) the string "1" to compare as equal to the number `1`, the empty string `""` to compare as equal to the number `0` and other surprising things. It appears that this comparison was done at an attempt at performance optimization, but that has little place in a test suite. Use the full recursive strict comparison instead. This requires updating one ParserCache test case which was apparently created incorrectly (or not properly updated) and relied on the previous behavior (numbers comparing as equal to strings) to pass. Change-Id: Ife0e9ccc7be0f4933975bb326203693bc15a9658 --- .../1.36-ParserOutput-withMetadata.serialized | Bin 2350 -> 2359 bytes .../libs/serialization/SerializationTestTrait.php | 4 ---- 2 files changed, 4 deletions(-) rewrite tests/phpunit/data/ParserCache/1.36-ParserOutput-withMetadata.serialized (94%) diff --git a/tests/phpunit/data/ParserCache/1.36-ParserOutput-withMetadata.serialized b/tests/phpunit/data/ParserCache/1.36-ParserOutput-withMetadata.serialized dissimilarity index 94% index 242048305887457d1f76f4a2704ea633c2d44137..2ea876b4b5f013b7e3c95665dde833bb63dc1842 100644 GIT binary patch delta 44 vcwSp4v|VUIzkIQkp_P)Ml6A3_rIk{0Vo7Rxeo-Zu4-_|2+PJKPgOLjWIcN<& delta 34 pcwXBsv`%P3zj&sVp>?s9rIk{0Vo7Rxeo>{Nl69t)(Z+Qh901J>3&8*Y diff --git a/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php b/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php index befdce17cae..edf46c3ed85 100644 --- a/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php +++ b/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php @@ -144,10 +144,6 @@ trait SerializationTestTrait { object $actual, ReflectionClass $class = null ) { - if ( $actual == $expected ) { - return; - } - if ( !$class ) { $class = new ReflectionClass( $expected ); } -- 2.11.4.GIT