function SimpleConfigSectionListTest::getSectionList

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Kernel/SimpleConfigSectionListTest.php \Drupal\Tests\layout_builder\Kernel\SimpleConfigSectionListTest::getSectionList()
  2. 11.x core/modules/layout_builder/tests/src/Kernel/SimpleConfigSectionListTest.php \Drupal\Tests\layout_builder\Kernel\SimpleConfigSectionListTest::getSectionList()

Sets up the section list.

Parameters

array $section_data: An array of section data.

Return value

\Drupal\layout_builder\SectionListInterface The section list.

Overrides SectionListTestBase::getSectionList

File

core/modules/layout_builder/tests/src/Kernel/SimpleConfigSectionListTest.php, line 33

Class

SimpleConfigSectionListTest
Tests the test implementation of section storage.

Namespace

Drupal\Tests\layout_builder\Kernel

Code

protected function getSectionList(array $section_data) {
  $config = $this->container
    ->get('config.factory')
    ->getEditable('layout_builder_test.test_simple_config.foobar');
  $section_data = array_map(function (Section $section) {
    return $section->toArray();
  }, $section_data);
  $config->set('sections', $section_data)
    ->save();
  $definition = new SectionStorageDefinition([
    'id' => 'test_simple_config',
  ]);
  $plugin = SimpleConfigSectionStorage::create($this->container, [], 'test_simple_config', $definition);
  $plugin->setContext('config_id', new Context(new ContextDefinition('string'), 'foobar'));
  return $plugin;
}

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