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