Skip to content

Commit

Permalink
Merge cae97d1 into 7042390
Browse files Browse the repository at this point in the history
  • Loading branch information
stchr committed Feb 5, 2021
2 parents 7042390 + cae97d1 commit b6801ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Expand Up @@ -29,7 +29,7 @@ class PropertySchemaRegexRestriction implements PropertySchemaRestrictionMetadat
*/
public function create(Constraint $constraint, PropertyMetadata $propertyMetadata): array
{
return isset($constraint->pattern) ? ['pattern' => $constraint->pattern] : [];
return $constraint->getHtmlPattern() ? ['pattern' => $constraint->getHtmlPattern()] : [];
}

/**
Expand Down
Expand Up @@ -300,7 +300,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
2 changes: 1 addition & 1 deletion tests/Fixtures/DummyValidatedEntity.php
Expand Up @@ -32,7 +32,7 @@ class DummyValidatedEntity
*
* @Assert\NotBlank
* @Assert\Length(max="4", min="10")
* @Assert\Regex(pattern="^dummy$")
* @Assert\Regex(pattern="/^dummy$/")
*/
public $dummy;

Expand Down

0 comments on commit b6801ee

Please sign in to comment.