Skip to content
Snippets Groups Projects
Commit 836d08a7 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2183881 by tim.plunkett: Remove Drupal::setContainer from LocalTaskDefaultTest.

parent 255a33f5
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -7,8 +7,8 @@
namespace Drupal\Tests\Core\Menu;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Menu\LocalTaskDefault;
use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
......@@ -84,11 +84,11 @@ protected function setUp() {
* Setups the local task default.
*/
protected function setupLocalTaskDefault() {
$container = new ContainerBuilder();
$container->set('string_translation', $this->stringTranslation);
$container->set('router.route_provider', $this->routeProvider);
\Drupal::setContainer($container);
$this->localTaskBase = new LocalTaskDefault($this->config, $this->pluginId, $this->pluginDefinition);
$this->localTaskBase = new TestLocalTaskDefault($this->config, $this->pluginId, $this->pluginDefinition);
$this->localTaskBase
->setRouteProvider($this->routeProvider)
->setTranslationManager($this->stringTranslation);
}
/**
......@@ -316,3 +316,10 @@ public function testGetOptions() {
}
}
class TestLocalTaskDefault extends LocalTaskDefault {
public function setRouteProvider(RouteProviderInterface $route_provider) {
$this->routeProvider = $route_provider;
return $this;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment