function EntityConverterTest::providerTestApplies

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityConverterTest::providerTestApplies()
  2. 8.9.x core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityConverterTest::providerTestApplies()
  3. 10 core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityConverterTest::providerTestApplies()

Provides test data for testApplies()

File

core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php, line 163

Class

EntityConverterTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21ParamConverter%21EntityConverter.php/class/EntityConverter/11.x" title="Parameter converter for upcasting entity IDs to full objects." class="local">\Drupal\Core\ParamConverter\EntityConverter</a> @group ParamConverter @group Entity

Namespace

Drupal\Tests\Core\ParamConverter

Code

public static function providerTestApplies() {
    $data = [];
    $data[] = [
        [
            'type' => 'entity:foo',
        ],
        'foo',
        new Route('/test/{foo}/bar'),
        FALSE,
    ];
    $data[] = [
        [
            'type' => 'entity:entity_test',
        ],
        'foo',
        new Route('/test/{foo}/bar'),
        TRUE,
    ];
    $data[] = [
        [
            'type' => 'entity:entity_test',
        ],
        'entity_test',
        new Route('/test/{entity_test}/bar'),
        TRUE,
    ];
    $data[] = [
        [
            'type' => 'entity:{entity_test}',
        ],
        'entity_test',
        new Route('/test/{entity_test}/bar'),
        FALSE,
    ];
    $data[] = [
        [
            'type' => 'entity:{entity_type}',
        ],
        'entity_test',
        new Route('/test/{entity_type}/{entity_test}/bar'),
        TRUE,
    ];
    $data[] = [
        [
            'type' => 'foo',
        ],
        'entity_test',
        new Route('/test/{entity_type}/{entity_test}/bar'),
        FALSE,
    ];
    return $data;
}

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