function BackendChainImplementationUnitTest::testSet
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testSet()
- 10 core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testSet()
- 11.x core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php \Drupal\Tests\Core\Cache\BackendChainImplementationUnitTest::testSet()
Tests that set will propagate.
File
-
core/
tests/ Drupal/ Tests/ Core/ Cache/ BackendChainImplementationUnitTest.php, line 124
Class
- BackendChainImplementationUnitTest
- Unit test of backend chain implementation specifics.
Namespace
Drupal\Tests\Core\CacheCode
public function testSet() {
$this->chain
->set('test', 123);
$cached = $this->firstBackend
->get('test');
$this->assertNotFalse($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->assertNotFalse($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->assertNotFalse($cached, 'Test key is in the third backend');
$this->assertSame(123, $cached->data, 'Test key has the right value');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.