function LinkNotExistingInternalConstraintValidatorTest::testValidate
Same name in other branches
- 8.9.x core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkNotExistingInternalConstraintValidatorTest.php \Drupal\Tests\link\Unit\Plugin\Validation\Constraint\LinkNotExistingInternalConstraintValidatorTest::testValidate()
@covers ::validate @dataProvider providerValidate
File
-
core/
modules/ link/ tests/ src/ Unit/ Plugin/ Validation/ Constraint/ LinkNotExistingInternalConstraintValidatorTest.php, line 22
Class
- LinkNotExistingInternalConstraintValidatorTest
- @coversDefaultClass \Drupal\link\Plugin\Validation\Constraint\LinkNotExistingInternalConstraintValidator @group Link
Namespace
Drupal\Tests\link\Unit\Plugin\Validation\ConstraintCode
public function testValidate($value, $valid) {
$context = $this->createMock(ExecutionContextInterface::class);
if ($valid) {
$context->expects($this->never())
->method('addViolation');
}
else {
$context->expects($this->once())
->method('addViolation');
}
$constraint = new LinkNotExistingInternalConstraint();
$validator = new LinkNotExistingInternalConstraintValidator();
$validator->initialize($context);
$validator->validate($value, $constraint);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.