function OverridesSectionStorageTest::providerTestAccess

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

Provides test data for ::testAccess().

File

core/modules/layout_builder/tests/src/Kernel/OverridesSectionStorageTest.php, line 121

Class

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

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',
            ]),
        ]),
    ];
    // Data provider values are:
    // - the expected outcome of the call to ::access()
    // - whether Layout Builder has been enabled for this display
    // - any section data
    // - any permissions to grant to the user.
    $data = [];
    $data['disabled, no data, no permissions'] = [
        FALSE,
        FALSE,
        [],
        [],
    ];
    $data['disabled, data, no permissions'] = [
        FALSE,
        FALSE,
        $section_data,
        [],
    ];
    $data['enabled, no data, no permissions'] = [
        FALSE,
        TRUE,
        [],
        [],
    ];
    $data['enabled, data, no permissions'] = [
        FALSE,
        TRUE,
        $section_data,
        [],
    ];
    $data['enabled, no data, configure any layout'] = [
        TRUE,
        TRUE,
        [],
        [
            'configure any layout',
        ],
    ];
    $data['enabled, data, configure any layout'] = [
        TRUE,
        TRUE,
        $section_data,
        [
            'configure any layout',
        ],
    ];
    $data['enabled, no data, bundle overrides'] = [
        TRUE,
        TRUE,
        [],
        [
            'configure all entity_test entity_test layout overrides',
        ],
    ];
    $data['enabled, data, bundle overrides'] = [
        TRUE,
        TRUE,
        $section_data,
        [
            'configure all entity_test entity_test layout overrides',
        ],
    ];
    $data['enabled, no data, bundle edit overrides, no edit access'] = [
        FALSE,
        TRUE,
        [],
        [
            'configure editable entity_test entity_test layout overrides',
        ],
    ];
    $data['enabled, data, bundle edit overrides, no edit access'] = [
        FALSE,
        TRUE,
        $section_data,
        [
            'configure editable entity_test entity_test layout overrides',
        ],
    ];
    $data['enabled, no data, bundle edit overrides, edit access'] = [
        TRUE,
        TRUE,
        [],
        [
            'configure editable entity_test entity_test layout overrides',
            'administer entity_test content',
        ],
    ];
    $data['enabled, data, bundle edit overrides, edit access'] = [
        TRUE,
        TRUE,
        $section_data,
        [
            'configure editable entity_test entity_test layout overrides',
            'administer entity_test content',
        ],
    ];
    return $data;
}

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