You are here

public function DrupalCacheAdapterTest::testUpdateStreamSuccess in Flysystem 8

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

File

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

Class

DrupalCacheAdapterTest
Test the Drupal Cache Adapter.

Namespace

Drupal\Tests\flysystem\Unit\Flysystem\Adapter

Code

public function testUpdateStreamSuccess() {
  $config = new Config();
  $stream = fopen('data:text/plain,contents', 'rb');
  $this->adapter
    ->updateStream(static::FILE, $stream, $config)
    ->willReturn([
    'mimetype' => 'test_mimetype',
  ]);
  $metadata = $this->cacheAdapter
    ->updateStream(static::FILE, $stream, $config);
  $this
    ->assertSame('test_mimetype', $metadata['mimetype']);
  $this
    ->assertSame('test_mimetype', $this->cacheAdapter
    ->getMimetype(static::FILE)['mimetype']);
  $this
    ->assertTrue($this->cacheItemBackend
    ->has(static::FILE));
}