Problem/Motivation

  1. Any value where the ExistsConstraint is used may be marked optional. So NULL should be allowed. (Similar issue for another constraint: #3416549: ConfigExistsConstraintValidator should ignore NULL values)
  2. Drupal core has a special "module" called core. This "module" is always installed. It is used for all plugins in the core/lib directory: no concrete module is then the provider of such a plugin, but core is. Hence it should be treated as a valid value.

Both of these problems were surfaced in #3379725: Make Block config entities fully validatable.

Steps to reproduce

N/A

Proposed resolution

  1. Allow NULL always, allow core if the type option is set to module.
  2. Test coverage.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

N/A

Issue fork drupal-3426324

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Assigned: wim leers » Unassigned
Status: Active » Needs review

Test-only CI job should fail.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Test-only has already been ran

There was 1 failure:
1) Drupal\KernelTests\Core\Extension\ExtensionExistsConstraintValidatorTest::testValidation
Failed asserting that actual size 1 matches expected size 0.
/builds/issue/drupal-3426324/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121
/builds/issue/drupal-3426324/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55
/builds/issue/drupal-3426324/core/tests/Drupal/KernelTests/Core/Extension/ExtensionExistsConstraintValidatorTest.php:38
/builds/issue/drupal-3426324/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.

This one had to read a few times but haven't used ExistsConstraint much yet. But idea of if module type and core is used makes sense.

Since this appears to be a blocker going to mark it.

alexpott’s picture

Version: 11.x-dev » 10.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed ab695b5cc6 to 11.x and d4c468d72b to 10.3.x and 5f758d452e to 10.2.x. Thanks!

  • alexpott committed 5f758d45 on 10.2.x
    Issue #3426324 by Wim Leers: ExistsConstraintValidator should ignore...

  • alexpott committed d4c468d7 on 10.3.x
    Issue #3426324 by Wim Leers: ExistsConstraintValidator should ignore...

  • alexpott committed ab695b5c on 11.x
    Issue #3426324 by Wim Leers: ExistsConstraintValidator should ignore...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.