function CacheableMetadataTest::testSetCacheMaxAge
Tests valid and invalid values as max age.
@legacy-covers ::setCacheMaxAge
Attributes
#[DataProvider('providerSetCacheMaxAge')]
File
-
core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheableMetadataTest.php, line 121
Class
Namespace
Drupal\Tests\Core\CacheCode
public function testSetCacheMaxAge($data, $expect_exception) : void {
$metadata = new CacheableMetadata();
if ($expect_exception) {
$this->expectException('\\InvalidArgumentException');
}
$metadata->setCacheMaxAge($data);
$this->assertEquals($data, $metadata->getCacheMaxAge());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.