diff --git a/Tests/Validator/Constraints/UniqueTest.php b/Tests/Validator/Constraints/UniqueTest.php new file mode 100644 index 00000000..8931700c --- /dev/null +++ b/Tests/Validator/Constraints/UniqueTest.php @@ -0,0 +1,43 @@ += 80000) { + $loader = new AnnotationLoader(); + } else { + $loader = new AnnotationLoader(new AnnotationReader()); + } + + self::assertTrue($loader->loadClassMetadata($metadata)); + + [$constraint] = $metadata->getConstraints(); + assert($constraint instanceof Unique); + self::assertSame(['email'], $constraint->fields); + self::assertSame('doctrine_odm.mongodb.unique', $constraint->validatedBy()); + } +} + +/** @Unique(fields={"email"}) */ +#[Unique(['email'])] +class UniqueDocumentDummyOne +{ + private string $email; +}