function EntityConverterTest::providerTestApplies

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityConverterTest::providerTestApplies()
  2. 10 core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityConverterTest::providerTestApplies()
  3. 11.x 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 170

Class

EntityConverterTest
@coversDefaultClass \Drupal\Core\ParamConverter\EntityConverter @group ParamConverter @group Entity

Namespace

Drupal\Tests\Core\ParamConverter

Code

public 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.