public function CacheableMetadataTest::testSetCacheMaxAge in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php \Drupal\Tests\Core\Cache\CacheableMetadataTest::testSetCacheMaxAge()
Tests valid and invalid values as max age.
@covers ::setCacheMaxAge @dataProvider providerSetCacheMaxAge
File
- core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheableMetadataTest.php, line 111
Class
- CacheableMetadataTest
- @coversDefaultClass \Drupal\Core\Cache\CacheableMetadata @group Cache
Namespace
Drupal\Tests\Core\CacheCode
public function testSetCacheMaxAge($data, $expect_exception) {
$metadata = new CacheableMetadata();
if ($expect_exception) {
$this
->expectException('\\InvalidArgumentException');
}
$metadata
->setCacheMaxAge($data);
$this
->assertEquals($data, $metadata
->getCacheMaxAge());
}