function ViewsTest::testHandlerManagerDeprecation
Tests the ::handlerManager() deprecation.
Attributes
#[Group('legacy')]
File
-
core/
modules/ views/ tests/ src/ Unit/ ViewsTest.php, line 259
Class
- ViewsTest
- Tests Drupal\views\Views.
Namespace
Drupal\Tests\views\UnitCode
public function testHandlerManagerDeprecation() : void {
$this->expectDeprecation('Drupal\\views\\Views::handlerManager() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal::service(\'plugin.manager.views.{type}\') for specific handler types or \\Drupal::service(\'views.plugin_managers\')->get($type) for dynamic types. See https://www.drupal.org/node/3566982');
$handler_manager = $this->createMock(ViewsHandlerManager::class);
$locator = $this->createMock(ServiceLocator::class);
$locator->expects($this->once())
->method('get')
->with('filter')
->willReturn($handler_manager);
$this->container
->set('views.plugin_managers', $locator);
// @phpstan-ignore staticMethod.deprecated
$result = Views::handlerManager('filter');
$this->assertSame($handler_manager, $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.