/** * @covers ::getCanonicalRoute * @dataProvider providerTestGetCanonicalRoute */ public function testGetCanonicalRoute(Route $expected = NULL, EntityTypeInterface $entity_type, FieldStorageDefinitionInterface $field_storage_definition = NULL) { if ($field_storage_definition) { $this->entityFieldManager->getFieldStorageDefinitions($entity_type->id())->willReturn([$entity_type->getKey('id') => $field_storage_definition]); } $route = $this->routeProvider->getCanonicalRoute($entity_type); $this->assertEquals($expected, $route); }
/** * @covers ::getCanonicalRoute * @dataProvider providerTestGetCanonicalRoute */ public function testGetCanonicalRoute($entity_type_prophecy, $expected, $field_storage_definition = NULL) { $entity_manager = $this->prophesize(EntityManagerInterface::class); $route_provider = new TestDefaultHtmlRouteProvider($entity_manager->reveal()); $entity_type = $entity_type_prophecy->reveal(); if ($field_storage_definition) { $entity_manager->getFieldStorageDefinitions($entity_type->id())->willReturn([$entity_type->getKey('id') => $field_storage_definition]); } $route = $route_provider->getCanonicalRoute($entity_type); $this->assertEquals($expected, $route); }