You are here

public function DrupalCacheAdapterTest::testDeleteDirSuccess in Flysystem 3.x

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

File

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

Class

DrupalCacheAdapterTest
Test the Drupal Cache Adapter.

Namespace

Drupal\Tests\flysystem\Unit\Flysystem\Adapter

Code

public function testDeleteDirSuccess() {
  $config = new Config();

  // Create a directory with one sub file.
  $this->adapter
    ->createDir('testdir', $config)
    ->willReturn([
    'type' => 'dir',
  ]);
  $this->adapter
    ->write('testdir/test.txt', 'contents', $config)
    ->willReturn([
    'size' => 1234,
  ]);
  $this->adapter
    ->deleteDir('testdir')
    ->willReturn(TRUE);
  $this->adapter
    ->listContents('testdir', TRUE)
    ->willReturn([
    [
      'path' => 'testdir',
    ],
    [
      'path' => 'testdir/test.txt',
    ],
  ]);
  $this->cacheAdapter
    ->createDir('testdir', $config);
  $this->cacheAdapter
    ->write('testdir/test.txt', 'contents', $config);
  $this
    ->assertTrue($this->cacheAdapter
    ->deleteDir('testdir'));
  $this
    ->assertFalse($this->cacheItemBackend
    ->has('testdir/test.txt'));
  $this
    ->assertFalse($this->cacheItemBackend
    ->has('testdir'));
}