function DefaultHtmlRouteProviderTest::providerTestGetCanonicalRoute
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php \Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest::providerTestGetCanonicalRoute()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php \Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest::providerTestGetCanonicalRoute()
- 11.x core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php \Drupal\Tests\Core\Entity\Routing\DefaultHtmlRouteProviderTest::providerTestGetCanonicalRoute()
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ Routing/ DefaultHtmlRouteProviderTest.php, line 213
Class
- DefaultHtmlRouteProviderTest
- @coversDefaultClass \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider @group Entity
Namespace
Drupal\Tests\Core\Entity\RoutingCode
public static function providerTestGetCanonicalRoute() {
$prophet = new Prophet();
$data = [];
$entity_type1 = static::getEntityType();
$entity_type1->hasLinkTemplate('canonical')
->willReturn(FALSE);
$data['no_canonical_link_template'] = [
NULL,
$entity_type1->reveal(),
];
$entity_type2 = static::getEntityType();
$entity_type2->hasLinkTemplate('canonical')
->willReturn(TRUE);
$entity_type2->hasViewBuilderClass()
->willReturn(FALSE);
$data['no_view_builder'] = [
NULL,
$entity_type2->reveal(),
];
$entity_type3 = static::getEntityType($entity_type2);
$entity_type3->hasViewBuilderClass()
->willReturn(TRUE);
$entity_type3->id()
->willReturn('the_entity_type_id');
$entity_type3->getLinkTemplate('canonical')
->willReturn('/the/canonical/link/template');
$entity_type3->entityClassImplements(FieldableEntityInterface::class)
->willReturn(FALSE);
$route = (new Route('/the/canonical/link/template'))->setDefaults([
'_entity_view' => 'the_entity_type_id.full',
'_title_callback' => '\\Drupal\\Core\\Entity\\Controller\\EntityController::title',
])
->setRequirements([
'_entity_access' => 'the_entity_type_id.view',
])
->setOptions([
'parameters' => [
'the_entity_type_id' => [
'type' => 'entity:the_entity_type_id',
],
],
]);
$data['id_key_type_null'] = [
clone $route,
$entity_type3->reveal(),
];
$entity_type4 = static::getEntityType($entity_type3);
$entity_type4->entityClassImplements(FieldableEntityInterface::class)
->willReturn(TRUE);
$entity_type4->getKey('id')
->willReturn('id');
$route->setRequirement('the_entity_type_id', '\\d+');
$field_storage_definition = $prophet->prophesize(FieldStorageDefinitionInterface::class);
$field_storage_definition->getType()
->willReturn('integer');
$data['id_key_type_integer'] = [
clone $route,
$entity_type4->reveal(),
$field_storage_definition->reveal(),
];
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.