You are here

public function DrupalCacheAdapterTest::testCopySuccess 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::testCopySuccess()
  2. 2.0.x tests/src/Unit/Flysystem/Adapter/DrupalCacheAdapterTest.php \Drupal\Tests\flysystem\Unit\Flysystem\Adapter\DrupalCacheAdapterTest::testCopySuccess()
  3. 3.0.x tests/src/Unit/Flysystem/Adapter/DrupalCacheAdapterTest.php \Drupal\Tests\flysystem\Unit\Flysystem\Adapter\DrupalCacheAdapterTest::testCopySuccess()

File

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

Class

DrupalCacheAdapterTest
Test the Drupal Cache Adapter.

Namespace

Drupal\Tests\flysystem\Unit\Flysystem\Adapter

Code

public function testCopySuccess() {
  $config = new Config();
  $this->adapter
    ->write(static::FILE, 'contents', $config)
    ->willReturn([
    'size' => 1234,
  ]);
  $this->cacheAdapter
    ->write(static::FILE, 'contents', $config);
  $this->adapter
    ->copy(static::FILE, 'new.txt')
    ->willReturn(TRUE);
  $this
    ->assertTrue($this->cacheAdapter
    ->copy(static::FILE, 'new.txt'));
  $this
    ->assertSame(1234, $this->cacheAdapter
    ->getSize(static::FILE)['size']);
  $this
    ->assertSame(1234, $this->cacheAdapter
    ->getSize('new.txt')['size']);
  $this
    ->assertTrue($this->cacheItemBackend
    ->has(static::FILE));
  $this
    ->assertTrue($this->cacheItemBackend
    ->has('new.txt'));
}