public function testGetInvalidDetails() { $validator = new DateTime(); $read = $validator->getInvalidDetails(); $expected = 'dateTime'; $this->assertSame($read, $expected); }
/** * {@inheritdoc} */ public function isValid($value, array $parameters) { if (count($parameters) < $this->amountOfParameters) { throw new ValidationException('"' . $this->type . '" expects at least ' . $this->amountOfParameters . ' parameter.'); } if (in_array($value, ['', null], true)) { return true; } $format = $this->getDateTimeFormat($parameters); $datetimes = $this->getDateTimes($parameters, $format); $date = \DateTime::createFromFormat($format, $value); if ($date === false) { return false; } return $this->isValidComparison($date, $datetimes, $parameters); }