You are here

public function DrupalCacheAdapterTest::testWriteStreamSuccess in Flysystem 3.0.x

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

File

tests/src/Unit/Flysystem/Adapter/DrupalCacheAdapterTest.php, line 78

Class

DrupalCacheAdapterTest
Test the Drupal Cache Adapter.

Namespace

Drupal\Tests\flysystem\Unit\Flysystem\Adapter

Code

public function testWriteStreamSuccess() {
  $config = new Config();
  $stream = fopen('data:text/plain,contents', 'rb');
  $this->adapter
    ->writeStream(static::FILE, $stream, $config)
    ->willReturn([
    'timestamp' => 12345,
  ]);
  $metadata = $this->cacheAdapter
    ->writeStream(static::FILE, $stream, $config);
  $this
    ->assertSame(12345, $metadata['timestamp']);
  $this
    ->assertSame(12345, $this->cacheAdapter
    ->getTimestamp(static::FILE)['timestamp']);
  $this
    ->assertTrue($this->cacheItemBackend
    ->has(static::FILE));
}