You are here

public function EntityConverterTest::providerTestApplies in Drupal 8

Same name and namespace in other branches
  1. 9 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 274

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;
}