You are here

public function AwsCacheAdapterTest::testBasicGetSetDelete 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::testBasicGetSetDelete()

File

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

Class

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

Namespace

NoDrupal\Tests\flysystem_s3\Unit

Code

public function testBasicGetSetDelete() {
  $backend = new MemoryBackend('foo');
  $cache = new AwsCacheAdapter($backend, 'bar_prefix:');
  $cache
    ->set('key', 'value');
  $this
    ->assertSame('value', $cache
    ->get('key'));
  $backend_item = $backend
    ->get('bar_prefix:key');
  $this
    ->assertSame('value', $backend_item->data);
  $this
    ->assertSame(-1, $backend_item->expire);
  $cache
    ->remove('key');
  $this
    ->assertNull($cache
    ->get('key'));
  $this
    ->assertFalse($backend
    ->get('bar_prefix:key'));
}