function PrivateTempStoreTest::testGetMetadata
Tests the getMetadata() method.
@legacy-covers ::getMetadata
File
- 
              core/tests/ Drupal/ Tests/ Core/ TempStore/ PrivateTempStoreTest.php, line 174 
Class
Namespace
Drupal\Tests\Core\TempStoreCode
public function testGetMetadata() : void {
  $this->keyValue
    ->expects($this->exactly(2))
    ->method('get')
    ->with('1:test')
    ->willReturnOnConsecutiveCalls($this->ownObject, FALSE);
  $metadata = $this->tempStore
    ->getMetadata('test');
  $this->assertInstanceOf(Lock::class, $metadata);
  $this->assertObjectHasProperty('ownerId', $metadata);
  $this->assertObjectHasProperty('updated', $metadata);
  // Data should get removed.
  $this->assertObjectNotHasProperty('data', $metadata);
  $this->assertNull($this->tempStore
    ->getMetadata('test'));
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
