function LinkNotExistingInternalConstraintValidatorTest::testValidateFromRoute
Same name and namespace in other branches
- 10 core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php \Drupal\Tests\link\Unit\Plugin\Validation\Constraint\LinkNotExistingInternalConstraintValidatorTest::testValidateFromRoute()
@covers ::validate
File
-
core/
modules/ link/ tests/ src/ Unit/ Plugin/ Validation/ Constraint/ LinkNotExistingInternalConstraintValidatorTest.php, line 44
Class
- LinkNotExistingInternalConstraintValidatorTest
- @coversDefaultClass <a href="/api/drupal/core%21modules%21link%21src%21Plugin%21Validation%21Constraint%21LinkNotExistingInternalConstraintValidator.php/class/LinkNotExistingInternalConstraintValidator/11.x" title="Validates the LinkNotExistingInternal constraint." class="local">\Drupal\link\Plugin\Validation\Constraint\LinkNotExistingInternalConstraintValidator</a> @group Link
Namespace
Drupal\Tests\link\Unit\Plugin\Validation\ConstraintCode
public function testValidateFromRoute() : void {
$url = Url::fromRoute('example.existing_route');
$urlGenerator = $this->createMock(UrlGeneratorInterface::class);
$urlGenerator->expects($this->any())
->method('generateFromRoute')
->with('example.existing_route', [], [])
->willReturn('/example/existing');
$url->setUrlGenerator($urlGenerator);
$link = $this->createMock(LinkItemInterface::class);
$link->expects($this->any())
->method('getUrl')
->willReturn($url);
$context = $this->createMock(ExecutionContextInterface::class);
$context->expects($this->never())
->method('addViolation');
$this->validate($link, $context);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.