You are here

public function NumericFieldValidationRuleTest::testNumeric in Field Validation 8

Test NumericFieldValidationRule.

File

tests/src/Kernel/Plugin/FieldValidationRule/NumericFieldValidationRuleTest.php, line 91

Class

NumericFieldValidationRuleTest
Tests NumericFieldValidationRule.

Namespace

Drupal\Tests\field_validation\Kernel\Plugin\FieldValidationRule

Code

public function testNumeric() {
  $this
    ->assertConstraintPass($this->entity, self::FIELD_NAME, $this->min);
  $this
    ->assertConstraintPass($this->entity, self::FIELD_NAME, $this->max);
  $this
    ->assertConstraintPass($this->entity, self::FIELD_NAME, $this->max - 1);
  $this
    ->assertConstraintPass($this->entity, self::FIELD_NAME, $this->min + 1);
  $this
    ->assertConstraintFail($this->entity, self::FIELD_NAME, $this->max + 1, $this->ruleSet);
  $this
    ->assertConstraintFail($this->entity, self::FIELD_NAME, $this->max + 1, $this->ruleSet);
}