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

Issue #2171315 by diarmy, tim.plunkett: Cleanup the container in UnitTestCase::tearDown.

parent 9de73791
No related branches found
No related tags found
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
...@@ -74,15 +74,6 @@ public function testLocks() { ...@@ -74,15 +74,6 @@ public function testLocks() {
$comment->postSave($storage_controller); $comment->postSave($storage_controller);
} }
/**
* {@inheritdoc}
*/
protected function tearDown() {
parent::tearDown();
$container = new ContainerBuilder();
\Drupal::setContainer($container);
}
} }
} }
namespace { namespace {
......
...@@ -46,12 +46,6 @@ protected function setUp() { ...@@ -46,12 +46,6 @@ protected function setUp() {
\Drupal::setContainer($container); \Drupal::setContainer($container);
} }
protected function tearDown() {
// Passes in an empty container.
$container = new ContainerBuilder();
\Drupal::setContainer($container);
}
/** /**
* Sets up the local task manager for the test. * Sets up the local task manager for the test.
*/ */
......
...@@ -119,15 +119,6 @@ protected function setUp() { ...@@ -119,15 +119,6 @@ protected function setUp() {
$this->users['user_last'] = $this->createUserSession(); $this->users['user_last'] = $this->createUserSession();
} }
/**
* {@inheritdoc}
*/
protected function tearDown() {
parent::tearDown();
$container = new ContainerBuilder();
\Drupal::setContainer($container);
}
/** /**
* Tests the has permission method. * Tests the has permission method.
* *
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\Tests; namespace Drupal\Tests;
use Drupal\Component\Utility\Random; use Drupal\Component\Utility\Random;
use Drupal\Core\DependencyInjection\ContainerBuilder;
/** /**
* Provides a base class and helpers for Drupal unit tests. * Provides a base class and helpers for Drupal unit tests.
...@@ -40,6 +41,17 @@ public static function getInfo() { ...@@ -40,6 +41,17 @@ public static function getInfo() {
throw new \RuntimeException("Sub-class must implement the getInfo method!"); throw new \RuntimeException("Sub-class must implement the getInfo method!");
} }
/**
* {@inheritdoc}
*/
protected function tearDown() {
parent::tearDown();
if (\Drupal::getContainer()) {
$container = new ContainerBuilder();
\Drupal::setContainer($container);
}
}
/** /**
* Generates a unique random string containing letters and numbers. * Generates a unique random string containing letters and numbers.
* *
......
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