function LinkExternalProtocolsConstraintValidatorTest::testUnexpectedValue
Tests validating a value that isn't a LinkItemInterface.
File
-
core/
modules/ link/ tests/ src/ Unit/ Plugin/ Validation/ Constraint/ LinkExternalProtocolsConstraintValidatorTest.php, line 128
Class
- LinkExternalProtocolsConstraintValidatorTest
- Tests Drupal\link\Plugin\Validation\Constraint\LinkExternalProtocolsConstraintValidator.
Namespace
Drupal\Tests\link\Unit\Plugin\Validation\ConstraintCode
public function testUnexpectedValue() : void {
$this->expectException(UnexpectedValueException::class);
$validator = new LinkExternalProtocolsConstraintValidator();
$context = $this->createMock(ExecutionContextInterface::class);
$validator->initialize($context);
$constraint = new LinkExternalProtocolsConstraint();
$validator->validate('bad value', $constraint);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.