From 33817013fe51994f804630911958414e5526d504 Mon Sep 17 00:00:00 2001 From: Sandro Gehri Date: Sat, 23 Aug 2025 12:35:32 +0200 Subject: [PATCH] Prevent duplicate attributes --- src/PendingCalls/TestCall.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index df84c73d..a65c8bb5 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -759,7 +759,12 @@ final class TestCall // @phpstan-ignore-line $this->testSuite->tests->set($this->testCaseMethod); if (! is_null($testCase = $this->testSuite->tests->get($this->filename))) { - $testCase->attributes = array_merge($testCase->attributes, $this->testCaseFactoryAttributes); + $attributesToMerge = array_filter( + $this->testCaseFactoryAttributes, + fn (Attribute $attributeToMerge): bool => array_filter($testCase->attributes, fn (Attribute $attribute): bool => serialize($attributeToMerge) === serialize($attribute)) === [] + ); + + $testCase->attributes = array_merge($testCase->attributes, $attributesToMerge); } } }