ForumListingBreadcrumbBuilder example


  public function testApplies($expected$route_name = NULL, $parameter_map = []) {
    // Make some test doubles.     $entity_type_manager = $this->createMock(EntityTypeManagerInterface::class);
    $config_factory = $this->getConfigFactoryStub([]);
    $forum_manager = $this->createMock('Drupal\forum\ForumManagerInterface');
    $translation_manager = $this->createMock('Drupal\Core\StringTranslation\TranslationInterface');

    // Make an object to test.     $builder = new ForumListingBreadcrumbBuilder($entity_type_manager$config_factory$forum_manager$translation_manager);

    $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface');
    $route_match->expects($this->once())
      ->method('getRouteName')
      ->willReturn($route_name);
    $route_match->expects($this->any())
      ->method('getParameter')
      ->willReturnMap($parameter_map);

    $this->assertEquals($expected$builder->applies($route_match));
  }

  
Home | Imprint | This part of the site doesn't use cookies.