function KeyValueEntityStorageTest::testLoad
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testLoad()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testLoad()
- 10 core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testLoad()
@covers ::load @covers ::postLoad
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ KeyValueStore/ KeyValueEntityStorageTest.php, line 476
Class
- KeyValueEntityStorageTest
- @coversDefaultClass \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage @group Entity
Namespace
Drupal\Tests\Core\Entity\KeyValueStoreCode
public function testLoad() : void {
$entity = $this->getMockEntity();
$this->entityType
->expects($this->once())
->method('getClass')
->willReturn(get_class($entity));
$this->setUpKeyValueEntityStorage();
$this->keyValueStore
->expects($this->once())
->method('getMultiple')
->with([
'foo',
])
->willReturn([
[
'id' => 'foo',
],
]);
$entity = $this->entityStorage
->load('foo');
$this->assertInstanceOf('Drupal\\Core\\Entity\\EntityInterface', $entity);
$this->assertSame('foo', $entity->id());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.