function LocalTaskManagerTest::testControllerResolverDeprecation

@expectedDeprecation Using the 'controller_resolver' service as the first argument is deprecated, use the 'http_kernel.controller.argument_resolver' instead. If your subclass requires the 'controller_resolver' service add it as an additional argument. See https://www.drupal.org/node/2959408. @group legacy

File

core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php, line 253

Class

LocalTaskManagerTest
@coversDefaultClass \Drupal\Core\Menu\LocalTaskManager @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

public function testControllerResolverDeprecation() {
    if (!in_array('Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface', class_implements('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver'))) {
        $this->markTestSkipped("Do not test ::getArguments() method when it is not implemented by Symfony's ControllerResolver.");
    }
    $controller_resolver = $this->getMockBuilder(ControllerResolver::class)
        ->disableOriginalConstructor()
        ->getMock();
    $request_stack = new RequestStack();
    $request_stack->push($this->request);
    $module_handler = $this->createMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
    $module_handler->expects($this->any())
        ->method('getModuleDirectories')
        ->willReturn([]);
    $language_manager = $this->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
    $language_manager->expects($this->any())
        ->method('getCurrentLanguage')
        ->will($this->returnValue(new Language([
        'id' => 'en',
    ])));
    new LocalTaskManager($controller_resolver, $request_stack, $this->routeMatch, $this->routeProvider, $module_handler, $this->cacheBackend, $language_manager, $this->accessManager, $this->account);
}

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