function ConfigEntityStorageTest::testLoadMultipleIds

Tests load multiple ids.

@legacy-covers ::loadMultiple @legacy-covers ::postLoad @legacy-covers ::mapFromStorageRecords @legacy-covers ::doLoadMultiple

File

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

Class

ConfigEntityStorageTest
Tests Drupal\Core\Config\Entity\ConfigEntityStorage.

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testLoadMultipleIds() : void {
  $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(),
  ]);
  $entities = $this->entityStorage
    ->loadMultiple([
    'foo',
  ]);
  $this->assertContainsOnlyInstancesOf(EntityInterface::class, $entities);
  foreach ($entities as $id => $entity) {
    $this->assertSame($id, $entity->id());
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.