You are here

public function BackendChainImplementationUnitTest::testSet in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testSet()

Test that set will propagate.

File

core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php, line 125
Contains \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest.

Class

BackendChainImplementationUnitTest
Unit test of backend chain implementation specifics.

Namespace

Drupal\Tests\Core\Cache

Code

public function testSet() {
  $this->chain
    ->set('test', 123);
  $cached = $this->firstBackend
    ->get('test');
  $this
    ->assertNotSame(FALSE, $cached, 'Test key is in the first backend');
  $this
    ->assertSame(123, $cached->data, 'Test key has the right value');
  $cached = $this->secondBackend
    ->get('test');
  $this
    ->assertNotSame(FALSE, $cached, 'Test key is in the second backend');
  $this
    ->assertSame(123, $cached->data, 'Test key has the right value');
  $cached = $this->thirdBackend
    ->get('test');
  $this
    ->assertNotSame(FALSE, $cached, 'Test key is in the third backend');
  $this
    ->assertSame(123, $cached->data, 'Test key has the right value');
}