You are here

public function DefaultsSectionStorageTest::providerTestExtractIdFromRoute in Drupal 8

Provides data for ::testExtractIdFromRoute().

File

core/modules/layout_builder/tests/src/Unit/DefaultsSectionStorageTest.php, line 125

Class

DefaultsSectionStorageTest
@coversDefaultClass \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage

Namespace

Drupal\Tests\layout_builder\Unit

Code

public function providerTestExtractIdFromRoute() {
  $data = [];
  $data['with value'] = [
    'foo.bar.baz',
    'foo.bar.baz',
    [],
  ];
  $data['empty value, without bundle'] = [
    'my_entity_type.bundle_name.default',
    '',
    [
      'entity_type_id' => 'my_entity_type',
      'view_mode_name' => 'default',
      'bundle_key' => 'my_bundle',
      'my_bundle' => 'bundle_name',
    ],
  ];
  $data['empty value, with bundle'] = [
    'my_entity_type.bundle_name.default',
    '',
    [
      'entity_type_id' => 'my_entity_type',
      'view_mode_name' => 'default',
      'bundle' => 'bundle_name',
    ],
  ];
  $data['without value, empty defaults'] = [
    NULL,
    '',
    [],
  ];
  return $data;
}