You are here

public function CacheItemTest::test in Flysystem 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/Flysystem/Adapter/CacheItemTest.php \Drupal\Tests\flysystem\Unit\Flysystem\Adapter\CacheItemTest::test()
  2. 3.x tests/src/Unit/Flysystem/Adapter/CacheItemTest.php \Drupal\Tests\flysystem\Unit\Flysystem\Adapter\CacheItemTest::test()
  3. 3.0.x tests/src/Unit/Flysystem/Adapter/CacheItemTest.php \Drupal\Tests\flysystem\Unit\Flysystem\Adapter\CacheItemTest::test()

Tests metadata updating and getting.

File

tests/src/Unit/Flysystem/Adapter/CacheItemTest.php, line 21

Class

CacheItemTest
Tests \Drupal\flysystem\Flysystem\Adapter\CacheItem.

Namespace

Drupal\Tests\flysystem\Unit\Flysystem\Adapter

Code

public function test() {
  $cache_item = new CacheItem();
  $metadata = [
    'size' => 1234,
    'mimetype' => 'test_mimetype',
    'visibility' => 'public',
    'timestamp' => 123456,
    'type' => 'file',
    'contents' => 'test contents',
    'path' => 'file_path',
  ];
  $cache_item
    ->updateMetadata($metadata);
  unset($metadata['contents'], $metadata['path']);
  $this
    ->assertSame($metadata, $cache_item
    ->getMetadata());
}