function DateElementBaseTest::testDatetimeRangeYears
Same name and namespace in other branches
- main core/tests/Drupal/Tests/Core/Datetime/Element/DateElementBaseTest.php \Drupal\Tests\Core\Datetime\Element\DateElementBaseTest::testDatetimeRangeYears()
Tests datetimeRangeYears() with various year range strings.
Attributes
#[DataProvider('providerTestDatetimeRangeYears')]
Parameters
string $range: The year range string to test.
int $expected_min: The expected minimum year.
int $expected_max: The expected maximum year.
File
-
core/
tests/ Drupal/ Tests/ Core/ Datetime/ Element/ DateElementBaseTest.php, line 48
Class
- DateElementBaseTest
- Tests the DateElementBase class.
Namespace
Drupal\Tests\Core\Datetime\ElementCode
public function testDatetimeRangeYears(string $range, int $expected_min, int $expected_max) : void {
$method = new \ReflectionMethod(DateElementBase::class, 'datetimeRangeYears');
/** @var array{string, string} $result */
$result = $method->invoke(NULL, $range);
[$min, $max] = $result;
$this->assertSame($expected_min, (int) $min);
$this->assertSame($expected_max, (int) $max);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.