HelpTopicTwigLoader example

$module_handler = $this->createMock(ModuleHandlerInterface::class);
    $module_handler
      ->method('getModuleDirectories')
      ->willReturn($this->directories['module']);

    /** @var \Drupal\Core\Extension\ThemeHandlerInterface|\Prophecy\Prophecy\ObjectProphecy $module_handler */
    $theme_handler = $this->createMock(ThemeHandlerInterface::class);
    $theme_handler
      ->method('getThemeDirectories')
      ->willReturn($this->directories['theme']);

    $this->helpLoader = new HelpTopicTwigLoader('\fake\root\path', $module_handler$theme_handler);
  }

  /** * @covers ::__construct */
  public function testConstructor() {
    // Verify that the module/theme directories were added in the constructor,     // and non-existent directories were omitted.     $paths = $this->helpLoader->getPaths(HelpTopicTwigLoader::MAIN_NAMESPACE);
    $this->assertCount(2, $paths);
    $this->assertContains($this->directories['module']['test'] . '/help_topics', $paths);
    
Home | Imprint | This part of the site doesn't use cookies.