class YamlRouteDiscoveryTest

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Routing/YamlRouteDiscoveryTest.php \Drupal\KernelTests\Core\Routing\YamlRouteDiscoveryTest

Tests \Drupal\Core\Routing\YamlRouteDiscovery.

Attributes

#[CoversClass(YamlRouteDiscovery::class)] #[Group('Routing')] #[RunTestsInSeparateProcesses]

Hierarchy

Expanded class hierarchy of YamlRouteDiscoveryTest

File

core/tests/Drupal/KernelTests/Core/Routing/YamlRouteDiscoveryTest.php, line 16

Namespace

Drupal\KernelTests\Core\Routing
View source
class YamlRouteDiscoveryTest extends KernelTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'router_test',
    'system',
  ];
  
  /**
   * Tests that string values for methods and schemes are supported.
   *
   * Symfony's route constructor accepts a single method or scheme as a
   * string, so routing.yml files may use strings as well as arrays.
   *
   * @see https://www.drupal.org/node/3608776
   */
  public function testStringMethodsAndSchemes() : void {
    $route = $this->container
      ->get('router.route_provider')
      ->getRouteByName('router_test.string_method_scheme');
    $this->assertSame([
      'GET',
    ], $route->getMethods());
    $this->assertSame([
      'https',
    ], $route->getSchemes());
  }

}

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