function AnonymousPrivateTempStoreTest::testAnonymousCanUsePrivateTempStoreSet
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php \Drupal\KernelTests\Core\TempStore\AnonymousPrivateTempStoreTest::testAnonymousCanUsePrivateTempStoreSet()
- 8.9.x core/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php \Drupal\KernelTests\Core\TempStore\AnonymousPrivateTempStoreTest::testAnonymousCanUsePrivateTempStoreSet()
- 10 core/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php \Drupal\KernelTests\Core\TempStore\AnonymousPrivateTempStoreTest::testAnonymousCanUsePrivateTempStoreSet()
Tests anonymous can use the PrivateTempStore.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ TempStore/ AnonymousPrivateTempStoreTest.php, line 47
Class
- AnonymousPrivateTempStoreTest
- Tests the PrivateTempStore for anonymous users.
Namespace
Drupal\KernelTests\Core\TempStoreCode
public function testAnonymousCanUsePrivateTempStoreSet() : void {
$this->tempStore
->set('foo', 'bar');
$metadata1 = $this->tempStore
->getMetadata('foo');
$this->assertEquals('bar', $this->tempStore
->get('foo'));
$this->assertNotEmpty($metadata1->getOwnerId());
$this->tempStore
->set('foo', 'bar2');
$metadata2 = $this->tempStore
->getMetadata('foo');
$this->assertEquals('bar2', $this->tempStore
->get('foo'));
$this->assertNotEmpty($metadata2->getOwnerId());
$this->assertEquals($metadata2->getOwnerId(), $metadata1->getOwnerId());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.