function SqlContentEntityStorageTest::testLoadMultiplePersistentCached
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testLoadMultiplePersistentCached()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testLoadMultiplePersistentCached()
- 11.x core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::testLoadMultiplePersistentCached()
@covers ::doLoadMultiple @covers ::buildCacheId @covers ::getFromPersistentCache
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ Sql/ SqlContentEntityStorageTest.php, line 1189
Class
- SqlContentEntityStorageTest
- @coversDefaultClass \Drupal\Core\Entity\Sql\SqlContentEntityStorage @group Entity
Namespace
Drupal\Tests\Core\Entity\SqlCode
public function testLoadMultiplePersistentCached() : void {
$this->setUpModuleHandlerNoImplementations();
$key = 'values:' . $this->entityTypeId . ':1';
$id = 1;
$entity = $this->getMockBuilder('\\Drupal\\Tests\\Core\\Entity\\Sql\\SqlContentEntityStorageTestEntityInterface')
->getMockForAbstractClass();
$entity->expects($this->any())
->method('id')
->willReturn($id);
$this->entityType
->expects($this->atLeastOnce())
->method('isPersistentlyCacheable')
->willReturn(TRUE);
$this->entityType
->expects($this->atLeastOnce())
->method('id')
->willReturn($this->entityTypeId);
$this->cache
->expects($this->once())
->method('getMultiple')
->with([
$key,
])
->willReturn([
$key => (object) [
'data' => $entity,
],
]);
$this->cache
->expects($this->never())
->method('set');
$this->setUpEntityStorage();
$entities = $this->entityStorage
->loadMultiple([
$id,
]);
$this->assertEquals($entity, $entities[$id]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.