Commit c07a96e6 authored by webchick's avatar webchick

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

parent 9de73791
......@@ -74,15 +74,6 @@ public function testLocks() {
$comment->postSave($storage_controller);
}
/**
* {@inheritdoc}
*/
protected function tearDown() {
parent::tearDown();
$container = new ContainerBuilder();
\Drupal::setContainer($container);
}
}
}
namespace {
......
......@@ -46,12 +46,6 @@ protected function setUp() {
\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.
*/
......
......@@ -119,15 +119,6 @@ protected function setUp() {
$this->users['user_last'] = $this->createUserSession();
}
/**
* {@inheritdoc}
*/
protected function tearDown() {
parent::tearDown();
$container = new ContainerBuilder();
\Drupal::setContainer($container);
}
/**
* Tests the has permission method.
*
......
......@@ -8,6 +8,7 @@
namespace Drupal\Tests;
use Drupal\Component\Utility\Random;
use Drupal\Core\DependencyInjection\ContainerBuilder;
/**
* Provides a base class and helpers for Drupal unit tests.
......@@ -40,6 +41,17 @@ public static function getInfo() {
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.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment