function DateTest::testLegacyMaxAgeFormattedDateDiff

Tests FormattedDateDiff.

@covers \Drupal\Core\Datetime\FormattedDateDiff::getMaxAge @group legacy @expectedDeprecation Drupal\Core\Datetime\FormattedDateDiff::getMaxAge() is deprecated in drupal:8.1.9 and is removed from drupal:9.0.0. Use \Drupal\Core\Datetime\FormattedDateDiff::getCacheMaxAge() instead. See https://www.drupal.org/node/2783545

File

core/tests/Drupal/Tests/Core/Datetime/DateTest.php, line 433

Class

DateTest
@coversDefaultClass \Drupal\Core\Datetime\DateFormatter @group Datetime

Namespace

Drupal\Tests\Core\Datetime

Code

public function testLegacyMaxAgeFormattedDateDiff() {
    $string = '10 minutes';
    $max_age = 60;
    $object = new FormattedDateDiff($string, $max_age);
    $this->assertSame($object->getCacheMaxAge(), $object->getMaxAge());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.