public function BackendChainImplementationUnitTest::testSet

Test that set will propagate.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Cache/BackendChainImplementationUnitTest.php, line 131
Definition of Drupal\system\Tests\Cache\BackendChainImplementationUnitTest.

Class

BackendChainImplementationUnitTest
Tests implementation-specific functionality of the BackendChain backend.

Namespace

Drupal\system\Tests\Cache

Code

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