function EntityResolverManagerTest::testSetRouteOptionsWithStandardRoute

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php \Drupal\Tests\Core\Entity\EntityResolverManagerTest::testSetRouteOptionsWithStandardRoute()
  2. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php \Drupal\Tests\Core\Entity\EntityResolverManagerTest::testSetRouteOptionsWithStandardRoute()
  3. 11.x core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php \Drupal\Tests\Core\Entity\EntityResolverManagerTest::testSetRouteOptionsWithStandardRoute()

Tests setRouteOptions() with no parameter.

We don't have any entity type involved, so we don't need any upcasting.

@covers ::setRouteOptions @covers ::getControllerClass

@dataProvider providerTestSetRouteOptionsWithStandardRoute

File

core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php, line 75

Class

EntityResolverManagerTest
@coversDefaultClass \Drupal\Core\Entity\EntityResolverManager @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testSetRouteOptionsWithStandardRoute($controller) : void {
    $route = new Route('/example', [
        '_controller' => $controller,
    ]);
    $defaults = $route->getDefaults();
    $this->entityResolverManager
        ->setRouteOptions($route);
    $this->assertEquals($defaults, $route->getDefaults());
    $this->assertEmpty($route->getOption('parameters'));
}

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