PathProcessorFront example

    $current_user = $this->getMockBuilder('Drupal\Core\Session\AccountInterface')
      ->getMock();

    // Create a config event subscriber stub.     $config_subscriber = $this->getMockBuilder('Drupal\language\EventSubscriber\ConfigSubscriber')
      ->disableOriginalConstructor()
      ->getMock();

    // Create the processors.     $alias_processor = new AliasPathProcessor($alias_manager);
    $decode_processor = new PathProcessorDecode();
    $front_processor = new PathProcessorFront($config_factory_stub);
    $language_processor = new PathProcessorLanguage($config_factory_stub$this->languageManager, $negotiator$current_user$config_subscriber);

    // First, test the processor manager with the processors in the incorrect     // order. The alias processor will run before the language processor, meaning     // aliases will not be found.     $priorities = [
      1000 => $alias_processor,
      500 => $decode_processor,
      300 => $front_processor,
      200 => $language_processor,
    ];

    

  public function testProcessInbound($frontpage_path$path$expected, array $expected_query = []) {
    $config_factory = $this->prophesize(ConfigFactoryInterface::class);
    $config = $this->prophesize(ImmutableConfig::class);
    $config_factory->get('system.site')
      ->willReturn($config->reveal());
    $config->get('page.front')
      ->willReturn($frontpage_path);
    $processor = new PathProcessorFront($config_factory->reveal());
    $request = new Request();
    $this->assertEquals($expected$processor->processInbound($path$request));
    $this->assertEquals($expected_query$request->query->all());
  }

  /** * Inbound paths and expected results. */
  public function providerProcessInbound() {
    return [
      'accessing frontpage' => ['/node', '/', '/node'],
      
Home | Imprint | This part of the site doesn't use cookies.