You are here

public function DefaultsSectionStorageTest::providerTestAccess in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest::providerTestAccess()

Provides test data for ::testAccess().

File

core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php, line 111

Class

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

Namespace

Drupal\Tests\layout_builder\Kernel

Code

public function providerTestAccess() {
  $section_data = [
    new Section('layout_onecol', [], [
      'first-uuid' => new SectionComponent('first-uuid', 'content', [
        'id' => 'foo',
      ], [
        'harold' => 'maude',
      ]),
    ], [
      'layout_builder_defaults_test' => [
        'which_party' => 'third',
      ],
    ]),
  ];

  // Data provider values are:
  // - the expected outcome of the call to ::access()
  // - the operation
  // - whether Layout Builder has been enabled for this display
  // - whether this display has any section data.
  $data = [];
  $data['view, disabled, no data'] = [
    FALSE,
    'view',
    FALSE,
    [],
  ];
  $data['view, enabled, no data'] = [
    TRUE,
    'view',
    TRUE,
    [],
  ];
  $data['view, disabled, data'] = [
    FALSE,
    'view',
    FALSE,
    $section_data,
  ];
  $data['view, enabled, data'] = [
    TRUE,
    'view',
    TRUE,
    $section_data,
  ];
  return $data;
}