You are here

public function BackendClearTests::testClearAll in Supercache 2.0.x

Same name and namespace in other branches
  1. 8 src/Tests/Generic/Cache/BackendClearTests.php \Drupal\supercache\Tests\Generic\Cache\BackendClearTests::testClearAll()

Test clears and that there is no leakage between binaries.

File

src/Tests/Generic/Cache/BackendClearTests.php, line 81

Class

BackendClearTests
Testea funciones basicas.

Namespace

Drupal\supercache\Tests\Generic\Cache

Code

public function testClearAll() {
  $this->backend
    ->set('item1', $this->defaultvalue);
  $this->backend
    ->set('item2', $this->defaultvalue);
  $this
    ->assertExists('ItemExists', $this->defaultvalue, 'item1');
  $this
    ->assertExists('ItemExists', $this->defaultvalue, 'item2');
  $this
    ->assertRemoved('Does not exist', 'item1', $this->backend2);
  $this
    ->assertRemoved('Does not exist', 'item2', $this->backend2);
  $this->backend2
    ->set('item1', $this->defaultvalue);
  $this->backend2
    ->set('item2', $this->defaultvalue);
  $this
    ->assertExists('ItemExists', $this->defaultvalue, 'item1', $this->backend2);
  $this
    ->assertExists('ItemExists', $this->defaultvalue, 'item2', $this->backend2);
  $this->backend
    ->removeBin();
  $this
    ->assertRemoved('Does not exist', 'item1', $this->backend);
  $this
    ->assertRemoved('Does not exist', 'item2', $this->backend);
  $this
    ->assertExists('ItemExists', $this->defaultvalue, 'item1', $this->backend2);
  $this
    ->assertExists('ItemExists', $this->defaultvalue, 'item2', $this->backend2);
  $this->backend2
    ->removeBin();
  $this
    ->assertRemoved('Does not exist', 'item1', $this->backend2);
  $this
    ->assertRemoved('Does not exist', 'item2', $this->backend2);
  $this->backend2
    ->set('item1', $this->defaultvalue);
  $this->backend2
    ->set('item2', $this->defaultvalue);
  $this
    ->assertExists('ItemExists', $this->defaultvalue, 'item1', $this->backend2);
  $this
    ->assertExists('ItemExists', $this->defaultvalue, 'item2', $this->backend2);
  $this->backend2
    ->deleteAll();
  $this
    ->assertRemoved('Does not exist', 'item1', $this->backend2);
  $this
    ->assertRemoved('Does not exist', 'item2', $this->backend2);
}