Skip to content

Email validator checkMX constraint - disable in test environment #16819

Closed
@benr77

Description

@benr77

When running test suites, I don't want to rely on an internet connection. However, I have defined the checkMX constraint on various email fields, and this does a remote DNS lookup to perform the validation.

Should it not be possible to tell the validator that for the test environment any remote DNS calls should be skipped? Currently some of my tests fail when there is no connectivity due to the MX lookup failing.

I have tried using expression syntax in the validation but this does not appear to work

email:
      - Email:
          message: The email {{ value }} does not seem to be valid.
          checkMX: @=parameter('kernel.environment') == 'test' ? false : true

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions