Skip to content

Commit

Permalink
Merge a1535b3 into f60fa8c
Browse files Browse the repository at this point in the history
  • Loading branch information
guilliamxavier committed Apr 8, 2021
2 parents f60fa8c + a1535b3 commit c7c8659
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class PropertySchemaRegexRestriction implements PropertySchemaRestrictionMetadat
*/
public function create(Constraint $constraint, PropertyMetadata $propertyMetadata): array
{
return $constraint instanceof Regex && $constraint->getHtmlPattern() ? ['pattern' => '^(?:'.$constraint->getHtmlPattern().')$'] : [];
return $constraint instanceof Regex && $constraint->getHtmlPattern() ? ['pattern' => '^('.$constraint->getHtmlPattern().')$'] : [];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public function testCreateWithPropertyRegexRestriction(): void
$schema = $validationPropertyMetadataFactory->create(DummyValidatedEntity::class, 'dummy')->getSchema();
$this->assertNotNull($schema);
$this->assertArrayHasKey('pattern', $schema);
$this->assertEquals('^(?:dummy)$', $schema['pattern']);
$this->assertEquals('^(dummy)$', $schema['pattern']);
}

public function testCreateWithPropertyFormatRestriction(): void
Expand Down Expand Up @@ -386,7 +386,7 @@ public function testCreateWithAtLeastOneOfConstraint(): void
$this->assertNotNull($schema);
$this->assertArrayHasKey('oneOf', $schema);
$this->assertSame([
['pattern' => '^(?:.*#.*)$'],
['pattern' => '^(.*#.*)$'],
['minLength' => 10],
], $schema['oneOf']);
}
Expand Down

0 comments on commit c7c8659

Please sign in to comment.