minor #38787 [Cache] Fix transient tests (jderusse)

This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] Fix transient tests

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Fix transient tests in cache like this one https://github.com/symfony/symfony/runs/1302566714?check_suite_focus=true

Commits
-------

b452e18ebc Fix transient tests
This commit is contained in:
Alexander M. Turek 2020-10-25 20:32:35 +01:00
commit 7ae1cc9e7a

View File

@ -116,11 +116,11 @@ abstract class AdapterTestCase extends CachePoolTest
$item = $cache->getItem('foo');
$expected = [
CacheItem::METADATA_EXPIRY => 9.5 + time(),
CacheItem::METADATA_CTIME => 1000,
];
$this->assertEqualsWithDelta($expected, $item->getMetadata(), .6, 'Item metadata should embed expiry and ctime.');
$metadata = $item->getMetadata();
$this->assertArrayHasKey(CacheItem::METADATA_CTIME, $metadata);
$this->assertEqualsWithDelta(1000, $metadata[CacheItem::METADATA_CTIME], 6);
$this->assertArrayHasKey(CacheItem::METADATA_EXPIRY, $metadata);
$this->assertEqualsWithDelta(9.5 + time(), $metadata[CacheItem::METADATA_EXPIRY], 0.6);
}
public function testDefaultLifeTime()