function OverridesSectionStorageTest::providerTestAccess

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

Class

OverridesSectionStorageTest
@coversDefaultClass \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage

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',
            ]),
        ]),
    ];
    // 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.