public function AnonymousPrivateTempStoreTest::testAnonymousCanUsePrivateTempStoreSet in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/TempStore/AnonymousPrivateTempStoreTest.php \Drupal\KernelTests\Core\TempStore\AnonymousPrivateTempStoreTest::testAnonymousCanUsePrivateTempStoreSet()
- 9 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 54
Class
- AnonymousPrivateTempStoreTest
- Tests the PrivateTempStore for anonymous users.
Namespace
Drupal\KernelTests\Core\TempStoreCode
public function testAnonymousCanUsePrivateTempStoreSet() {
$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());
}