ContentModerationRouteSubscriber example


  protected $routeSubscriber;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
    $entity_type_manager = $this->createMock(EntityTypeManagerInterface::class);
    $this->routeSubscriber = new ContentModerationRouteSubscriber($entity_type_manager);
    $this->setupEntityTypes();
  }

  /** * Creates the entity type manager mock returning entity type objects. */
  protected function setupEntityTypes() {
    $definition = $this->createMock(EntityTypeInterface::class);
    $definition->expects($this->any())
      ->method('getClass')
      ->willReturn(TestEntity::class);
    
Home | Imprint | This part of the site doesn't use cookies.