function LinkTypeConstraintValidatorTest::testEmptyField
Same name and namespace in other branches
- 11.x core/modules/link/tests/src/Unit/Plugin/Validation/Constraint/LinkTypeConstraintValidatorTest.php \Drupal\Tests\link\Unit\Plugin\Validation\Constraint\LinkTypeConstraintValidatorTest::testEmptyField()
Tests validating an empty Link field.
File
-
core/
modules/ link/ tests/ src/ Unit/ Plugin/ Validation/ Constraint/ LinkTypeConstraintValidatorTest.php, line 183
Class
- LinkTypeConstraintValidatorTest
- Tests LinkTypeConstraintValidator.
Namespace
Drupal\Tests\link\Unit\Plugin\Validation\ConstraintCode
public function testEmptyField() : void {
$link = $this->createMock(LinkItemInterface::class);
$link->method('getFieldDefinition')
->willReturn($this->getMockFieldDefinition(LinkItemInterface::LINK_INTERNAL));
$link->expects($this->once())
->method('isEmpty')
->willReturn(TRUE);
$link->expects($this->never())
->method('getUrl');
$context = $this->createStub(ExecutionContextInterface::class);
$this->doValidate($link, $context);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.