You are here

public function AwsCacheAdapterTest::testTtlIsSet in Flysystem - S3 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/AwsCacheAdapterTest.php \NoDrupal\Tests\flysystem_s3\Unit\AwsCacheAdapterTest::testTtlIsSet()

File

tests/src/Unit/AwsCacheAdapterTest.php, line 38

Class

AwsCacheAdapterTest
@coversDefaultClass \Drupal\flysystem_s3\AwsCacheAdapter @covers \Drupal\flysystem_s3\AwsCacheAdapter @group flysystem_s3

Namespace

NoDrupal\Tests\flysystem_s3\Unit

Code

public function testTtlIsSet() {
  $backend = new MemoryBackend('foo');
  $cache = new AwsCacheAdapter($backend);
  $cache
    ->set('key', 'value', 10);

  // This should work unles the system running the test is extremely slow.
  $expires = time() + 10;
  $this
    ->assertSame('value', $cache
    ->get('key'));
  $backend_item = $backend
    ->get('key');
  $this
    ->assertSame($expires, $backend_item->expire);
}