From 61b34671c7f4b21597a0bd5cfa669ed4dd4d46c4 Mon Sep 17 00:00:00 2001 From: Mathias Gelhausen Date: Wed, 19 Feb 2020 11:34:22 +0100 Subject: [PATCH] refactor(TestSetterAndGetterTrait): Do not automatically set 'assert' to 'same' if value is an object It was impossible to check a object values for equality without specifying the 'assert' method. This could have been unintuitive in certain test situations - while the opposite case ( check value objects to be the exact same) had not to be made explicit. Now checking if two value objects are the same has to be made explicit by specifying the assert method. --- src/TestCase/TestSetterAndGetterTrait.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/TestCase/TestSetterAndGetterTrait.php b/src/TestCase/TestSetterAndGetterTrait.php index fb653c4..70aced6 100644 --- a/src/TestCase/TestSetterAndGetterTrait.php +++ b/src/TestCase/TestSetterAndGetterTrait.php @@ -259,9 +259,6 @@ private function setterAndGetterNormalizeSpec($spec, string $name, object $targe case 'setter_value': if ('__SELF__' === $value) { $value = $target; - if (!isset($spec['setter_assert'])) { - $normalized['setter_assert'] = [static::class, 'assertSame']; - } } break; @@ -288,13 +285,6 @@ private function setterAndGetterNormalizeSpec($spec, string $name, object $targe $args = $value[1] ?? []; $key = substr($key, 0, -7); $value = new $class(...$args); - - $assertKey = str_replace('value', 'assert', $key); - - if (!isset($spec[$assertKey]) && array_key_exists($assertKey, $normalized)) { - $normalized[$assertKey] = [static::class, 'assertSame']; - } - break; case 'value_callback':