You are here

public function IpFieldValidationRuleTest::testValidIpRule in Field Validation 8

Tests valid ip inputs.

@dataProvider ipValidProvider

Parameters

string $version: IP version.

string $value: Value to test.

Throws

\Drupal\Core\Entity\EntityStorageException

File

tests/src/Kernel/Plugin/FieldValidationRule/IpFieldValidationRuleTest.php, line 93

Class

IpFieldValidationRuleTest
Tests IpFieldValidationRule.

Namespace

Drupal\Tests\field_validation\Kernel\Plugin\FieldValidationRule

Code

public function testValidIpRule(string $version, string $value) {
  $this->ruleSet = $this
    ->updateSettings([
    'version' => $version,
  ], self::RULE_ID, self::RULE_TITLE, $this->ruleSet, self::FIELD_NAME);
  $this
    ->assertConstraintPass($this->entity, self::FIELD_NAME, $value);
}