function EntityConverterTest::testGetRouteRequirement
Tests getRouteRequirement().
@legacy-covers ::getRouteRequirement
Attributes
#[DataProvider('providerTestGetRouteRequirement')]
File
-
core/
tests/ Drupal/ Tests/ Core/ ParamConverter/ EntityConverterTest.php, line 281
Class
Namespace
Drupal\Tests\Core\ParamConverterCode
public function testGetRouteRequirement(array $definition, ?string $expected) : void {
$this->entityTypeManager = $this->createStub(EntityTypeManagerInterface::class);
$this->entityRepository = $this->createStub(EntityRepositoryInterface::class);
$this->entityConverter = new EntityConverter($this->entityTypeManager, $this->entityRepository);
$config_entity_type = $this->createStub(ConfigEntityTypeInterface::class);
$content_entity_type = $this->createStub(ContentEntityTypeInterface::class);
$this->entityTypeManager
->method('getDefinition')
->willReturnMap([
[
'config_test',
FALSE,
$config_entity_type,
],
[
'entity_test',
FALSE,
$content_entity_type,
],
]);
$this->assertSame($expected, $this->entityConverter
->getRouteRequirement($definition, 'foo'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.