PathChangedHelperTest.php

Namespace

Drupal\Tests\Core\Routing

File

core/tests/Drupal/Tests/Core/Routing/PathChangedHelperTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Routing;

use Drupal\Core\Routing\PathChangedHelper;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\Request;

/**
 * @coversDefaultClass \Drupal\Core\Routing\PathChangedHelper
 * @group Routing
 */
class PathChangedHelperTest extends UnitTestCase {
  
  /**
   * Tests that the constructor validates its arguments.
   *
   * @covers ::__construct
   */
  public function testPathChangedHelperException() : void {
    $route_match = $this->prophesize(RouteMatchInterface::class);
    $route_match->getRouteName()
      ->willReturn('path.changed.not-bc');
    $this->expectException(\InvalidArgumentException::class);
    $this->expectExceptionMessage('Drupal\\Core\\Routing\\PathChangedHelper expects a route name that ends with ".bc".');
    new PathChangedHelper($route_match->reveal(), new Request());
  }

}

Classes

Title Deprecated Summary
PathChangedHelperTest @coversDefaultClass \Drupal\Core\Routing\PathChangedHelper[[api-linebreak]] @group Routing

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.