function EntityTypeManagerTest::testGetRouteProviders

Tests get route providers.

@legacy-covers ::getRouteProviders

File

core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php, line 365

Class

EntityTypeManagerTest
Tests Drupal\Core\Entity\EntityTypeManager.

Namespace

Drupal\Tests\Core\Entity

Code

public function testGetRouteProviders() : void {
  $apple = $this->prophesize(EntityTypeInterface::class);
  $apple->getRouteProviderClasses()
    ->willReturn([
    'default' => TestRouteProvider::class,
  ]);
  $this->setUpEntityTypeDefinitions([
    'apple' => $apple,
  ]);
  $apple_route_provider = $this->entityTypeManager
    ->getRouteProviders('apple');
  $this->assertInstanceOf(TestRouteProvider::class, $apple_route_provider['default']);
  $this->assertInstanceOf(ModuleHandlerInterface::class, $apple_route_provider['default']->moduleHandler);
  $this->assertInstanceOf(TranslationInterface::class, $apple_route_provider['default']->stringTranslation);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.