public function LinkNotExistingInternalConstraintValidatorTest::testValidateWithMalformedUri in Drupal 9
Same name and namespace in other branches
- 8 core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php \Drupal\Tests\link\Unit\Plugin\Validation\Constraint\LinkNotExistingInternalConstraintValidatorTest::testValidateWithMalformedUri()
@covers ::validate
See also
\Drupal\Core\Url::fromUri
File
- core/
modules/ link/ tests/ src/ Unit/ Plugin/ Validation/ Constraint/ LinkNotExistingInternalConstraintValidatorTest.php, line 91
Class
- LinkNotExistingInternalConstraintValidatorTest
- @coversDefaultClass \Drupal\link\Plugin\Validation\Constraint\LinkNotExistingInternalConstraintValidator @group Link
Namespace
Drupal\Tests\link\Unit\Plugin\Validation\ConstraintCode
public function testValidateWithMalformedUri() {
$link = $this
->createMock('Drupal\\link\\LinkItemInterface');
$link
->expects($this
->any())
->method('getUrl')
->willThrowException(new \InvalidArgumentException());
$context = $this
->createMock(ExecutionContextInterface::class);
$context
->expects($this
->never())
->method('addViolation');
$constraint = new LinkNotExistingInternalConstraint();
$validator = new LinkNotExistingInternalConstraintValidator();
$validator
->initialize($context);
$validator
->validate($link, $constraint);
}