Skip to content

Commit f11f3aa

Browse files
authored
Merge pull request #1464 from gehrisandro/sandro/prevent-duplicate-attributes
Prevent duplicate attributes
2 parents 7f11ace + 3381701 commit f11f3aa

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/PendingCalls/TestCall.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,12 @@ public function __destruct()
759759
$this->testSuite->tests->set($this->testCaseMethod);
760760

761761
if (! is_null($testCase = $this->testSuite->tests->get($this->filename))) {
762-
$testCase->attributes = array_merge($testCase->attributes, $this->testCaseFactoryAttributes);
762+
$attributesToMerge = array_filter(
763+
$this->testCaseFactoryAttributes,
764+
fn (Attribute $attributeToMerge): bool => array_filter($testCase->attributes, fn (Attribute $attribute): bool => serialize($attributeToMerge) === serialize($attribute)) === []
765+
);
766+
767+
$testCase->attributes = array_merge($testCase->attributes, $attributesToMerge);
763768
}
764769
}
765770
}

0 commit comments

Comments
 (0)