You are here

public function ConfigEntityStorageTest::testLoadMultipleIds in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testLoadMultipleIds()
  2. 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testLoadMultipleIds()

@covers ::loadMultiple @covers ::postLoad @covers ::mapFromStorageRecords @covers ::doLoadMultiple

File

core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php, line 618

Class

ConfigEntityStorageTest
@coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testLoadMultipleIds() {
  $config_object = $this
    ->prophesize(ImmutableConfig::class);
  $config_object
    ->get()
    ->willReturn([
    'id' => 'foo',
  ]);
  $config_object
    ->get('id')
    ->willReturn('foo');
  $config_object
    ->getCacheContexts()
    ->willReturn([]);
  $config_object
    ->getCacheTags()
    ->willReturn([
    'config:foo',
  ]);
  $config_object
    ->getCacheMaxAge()
    ->willReturn(Cache::PERMANENT);
  $config_object
    ->getName()
    ->willReturn('foo');
  $this->configFactory
    ->loadMultiple([
    'the_provider.the_config_prefix.foo',
  ])
    ->willReturn([
    $config_object
      ->reveal(),
  ]);
  $this->moduleHandler
    ->getImplementations('entity_load')
    ->willReturn([]);
  $this->moduleHandler
    ->getImplementations('test_entity_type_load')
    ->willReturn([]);
  $entities = $this->entityStorage
    ->loadMultiple([
    'foo',
  ]);
  $this
    ->assertContainsOnlyInstancesOf(EntityInterface::class, $entities);
  foreach ($entities as $id => $entity) {
    $this
      ->assertSame($id, $entity
      ->id());
  }
}