function DefaultsSectionStorageTest::providerTestAccess

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest::providerTestAccess()
  2. 8.9.x core/modules/layout_builder/tests/src/Kernel/DefaultsSectionStorageTest.php \Drupal\Tests\layout_builder\Kernel\DefaultsSectionStorageTest::providerTestAccess()
  3. 10 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 114

Class

DefaultsSectionStorageTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21layout_builder%21src%21Plugin%21SectionStorage%21DefaultsSectionStorage.php/class/DefaultsSectionStorage/11.x" title="Defines the &#039;defaults&#039; section storage type." class="local">\Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage</a>

Namespace

Drupal\Tests\layout_builder\Kernel

Code

public static function providerTestAccess() {
    $section_data = [
        new Section('layout_onecol', [], [
            '10000000-0000-1000-a000-000000000000' => new SectionComponent('10000000-0000-1000-a000-000000000000', '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;
}

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