You are here

public function DateRangeFieldValidationRuleTest::testInvalidDateRangeRule in Field Validation 8

Tests invalid date inputs.

@dataProvider dateInvalidProvider

Parameters

string $cycle: Cycle setting.

string $date_string: Input.

string $min_date: Minimum date.

string $max_date: Maximal date.

Throws

\Drupal\Core\Entity\EntityStorageException

File

tests/src/Kernel/Plugin/FieldValidationRule/DateRangeFieldValidationRuleTest.php, line 141

Class

DateRangeFieldValidationRuleTest
Tests DateRangeFieldValidationRule.

Namespace

Drupal\Tests\field_validation\Kernel\Plugin\FieldValidationRule

Code

public function testInvalidDateRangeRule(string $cycle, string $date_string, string $min_date, string $max_date) {
  $this->ruleSet = $this
    ->updateSettings([
    'min' => $min_date,
    'max' => $max_date,
    'cycle' => $cycle,
  ], self::RULE_ID, self::RULE_TITLE, $this->ruleSet, self::FIELD_NAME);
  $this
    ->assertConstraintFail($this->entity, self::FIELD_NAME, $date_string, $this->ruleSet);
}