/** * @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); }
/** * @covers ::getEntityTypeIdKeyType */ public function testGetEntityTypeIdKeyTypeNotFieldable() { $entity_type = $this->prophesize(EntityTypeInterface::class); $entity_type->isSubclassOf(FieldableEntityInterface::class)->willReturn(FALSE); $this->entityFieldManager->getFieldStorageDefinitions(Argument::any())->shouldNotBeCalled(); $type = $this->routeProvider->getEntityTypeIdKeyType($entity_type->reveal()); $this->assertNull($type); }