public function ConfigEntityStorageTest::testLoadMultipleAll in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testLoadMultipleAll()
- 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testLoadMultipleAll()
@covers ::loadMultiple @covers ::postLoad @covers ::mapFromStorageRecords @covers ::doLoadMultiple
File
- core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityStorageTest.php, line 577
Class
- ConfigEntityStorageTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testLoadMultipleAll() {
$foo_config_object = $this
->prophesize(ImmutableConfig::class);
$foo_config_object
->get()
->willReturn([
'id' => 'foo',
]);
$foo_config_object
->get('id')
->willReturn('foo');
$foo_config_object
->getCacheContexts()
->willReturn([]);
$foo_config_object
->getCacheTags()
->willReturn([
'config:foo',
]);
$foo_config_object
->getCacheMaxAge()
->willReturn(Cache::PERMANENT);
$foo_config_object
->getName()
->willReturn('foo');
$bar_config_object = $this
->prophesize(ImmutableConfig::class);
$bar_config_object
->get()
->willReturn([
'id' => 'bar',
]);
$bar_config_object
->get('id')
->willReturn('bar');
$bar_config_object
->getCacheContexts()
->willReturn([]);
$bar_config_object
->getCacheTags()
->willReturn([
'config:bar',
]);
$bar_config_object
->getCacheMaxAge()
->willReturn(Cache::PERMANENT);
$bar_config_object
->getName()
->willReturn('foo');
$this->configFactory
->listAll('the_provider.the_config_prefix.')
->willReturn([
'the_provider.the_config_prefix.foo',
'the_provider.the_config_prefix.bar',
]);
$this->configFactory
->loadMultiple([
'the_provider.the_config_prefix.foo',
'the_provider.the_config_prefix.bar',
])
->willReturn([
$foo_config_object
->reveal(),
$bar_config_object
->reveal(),
]);
$this->moduleHandler
->getImplementations('entity_load')
->willReturn([]);
$this->moduleHandler
->getImplementations('test_entity_type_load')
->willReturn([]);
$entities = $this->entityStorage
->loadMultiple();
$expected['foo'] = 'foo';
$expected['bar'] = 'bar';
$this
->assertContainsOnlyInstancesOf(EntityInterface::class, $entities);
foreach ($entities as $id => $entity) {
$this
->assertSame($id, $entity
->id());
$this
->assertSame($expected[$id], $entity
->id());
}
}