function OverridesSectionStorageTest::providerTestExtractEntityFromRoute

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

Provides data for ::testExtractEntityFromRoute().

File

core/modules/layout_builder/tests/src/Unit/OverridesSectionStorageTest.php, line 123

Class

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

Namespace

Drupal\Tests\layout_builder\Unit

Code

public static function providerTestExtractEntityFromRoute() {
    // Data provider values are:
    // - whether a successful result is expected
    // - the expected entity ID
    // - the value to pass to ::extractEntityFromRoute()
    // - the defaults to pass to ::extractEntityFromRoute().
    $data = [];
    $data['with value, with layout'] = [
        TRUE,
        'my_entity_type',
        'my_entity_type.entity_with_layout',
        [],
    ];
    $data['with value, without layout'] = [
        TRUE,
        'my_entity_type',
        'my_entity_type.entity_without_layout',
        [],
    ];
    $data['empty value, populated defaults'] = [
        TRUE,
        'my_entity_type',
        '',
        [
            'entity_type_id' => 'my_entity_type',
            'my_entity_type' => 'entity_with_layout',
        ],
    ];
    $data['empty value, empty defaults'] = [
        FALSE,
        NULL,
        '',
        [],
    ];
    return $data;
}

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