You are here

public function EasyBreadcrumbBuilderTest::testFrontpageWithInvalidPaths in Easy Breadcrumb 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/EasyBreadcrumbBuilderTest.php \Drupal\Tests\easy_breadcrumb\Kernel\EasyBreadcrumbBuilderTest::testFrontpageWithInvalidPaths()

Tests the front page with an invalid path.

File

tests/src/Kernel/EasyBreadcrumbBuilderTest.php, line 28

Class

EasyBreadcrumbBuilderTest
Tests the easy breadcrumb builder.

Namespace

Drupal\Tests\easy_breadcrumb\Kernel

Code

public function testFrontpageWithInvalidPaths() {
  \Drupal::configFactory()
    ->getEditable(EasyBreadcrumbConstants::MODULE_SETTINGS)
    ->set('include_invalid_paths', TRUE)
    ->set('include_title_segment', TRUE)
    ->save();
  \Drupal::configFactory()
    ->getEditable('system.site')
    ->set('page.front', '/path')
    ->save();
  $request_context = new RequestContext();
  $breadcrumb_builder = new EasyBreadcrumbBuilder($request_context, \Drupal::service('access_manager'), \Drupal::service('router'), \Drupal::service('request_stack'), \Drupal::service('path_processor_manager'), \Drupal::service('config.factory'), \Drupal::service('title_resolver'), \Drupal::service('current_user'), \Drupal::service('path.current'), \Drupal::service('plugin.manager.menu.link'), \Drupal::service('language_manager'), \Drupal::service('entity_type.manager'), \Drupal::service('entity.repository'), \Drupal::service('logger.factory'), \Drupal::service('messenger'), \Drupal::service('module_handler'));
  $route_match = new RouteMatch('test_front', new Route('/front'));
  $result = $breadcrumb_builder
    ->build($route_match);
  $this
    ->assertCount(0, $result
    ->getLinks());
}