public function FieldValidationRuleBase::assertConstraintPass in Field Validation 8
Helper method for passed assertions.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: EntityInterface to validate.
string $fieldName: Which field to validate.
mixed $value: Which value to validate.
13 calls to FieldValidationRuleBase::assertConstraintPass()
- BlackListFieldValidationRuleTest::testBlacklistRule in tests/
src/ Kernel/ Plugin/ FieldValidationRule/ BlackListFieldValidationRuleTest.php - Tests BlacklistFieldValidationRule.
- DateRangeFieldValidationRuleTest::testValidDateRangeRule in tests/
src/ Kernel/ Plugin/ FieldValidationRule/ DateRangeFieldValidationRuleTest.php - Tests valid date inputs.
- EmailFieldValidationRuleTest::testEmailRule in tests/
src/ Kernel/ Plugin/ FieldValidationRule/ EmailFieldValidationRuleTest.php - Test EmailFieldValidationRule.
- IntegerFieldValidationTest::testInteger in tests/
src/ Kernel/ Plugin/ FieldValidationRule/ IntegerFieldValidationTest.php - Test IntegerFieldValidationRule.
- IpFieldValidationRuleTest::testValidIpRule in tests/
src/ Kernel/ Plugin/ FieldValidationRule/ IpFieldValidationRuleTest.php - Tests valid ip inputs.
File
- tests/
src/ Kernel/ Plugin/ FieldValidationRule/ FieldValidationRuleBase.php, line 134
Class
- FieldValidationRuleBase
- FieldValidationRuleBase class.
Namespace
Drupal\Tests\field_validation\Kernel\Plugin\FieldValidationRuleCode
public function assertConstraintPass(EntityInterface $entity, string $fieldName, $value) {
$entity
->get($fieldName)->value = $value;
$violations = $entity
->validate();
$this
->assertCount(0, $violations);
}