Problem/Motivation

WebTestBase::rebuildContainer describes you get a new kernel instance, but in fact all you do is to get a new container instance.

Proposed resolution

Let's do that, and also clean up the not used function call inside the function itself.

Remaining tasks

User interface changes

API changes

CommentFileSizeAuthor
#2 2426735-1.patch1.39 KBdawehner
#1 2426735-1.patch62.3 KBdawehner

Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new62.3 KB

.

dawehner’s picture

StatusFileSize
new1.39 KB

This time with the right patch.

jhodgdon’s picture

Component: documentation » simpletest.module

Hm. The new docs look a bit confusing. If the kernel is not updated by this method, then I think we should just take out the mention of the kernel from the docs? As it is I was confused about the kernel mention.

I'm also not sure that the $request = \Drupal::request(); is a complete no-op. It doesn't seem to break anything in the automated tests, but the method is capable of actually resetting an array pointer if you trace it down the stack. And in any case, if you're going to remove that line of code this needs to move to the simpletest component as it's not just docs.

daffie’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.
The part with the kernel instance is not necessary.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Test code is not subject to beta restrictions. Committed e40099f and pushed to 8.0.x. Thanks!

diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index 9808cd0..51a46cc 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -1138,13 +1138,10 @@ protected function writeCustomTranslations() {
   /**
    * Rebuilds \Drupal::getContainer().
    *
-   * Use this to build a new service container. For example, when the
-   * list of enabled modules is changed via the internal browser, in which case
-   * the test process still contains the kernel and the old service container
-   * with an old module list.
-   *
-   * Note: This rebuild process is handled by the kernel, so you don't get a new
-   *   instance of it.
+   * Use this to update the test process's kernel with a new service container.
+   * For example, when the list of enabled modules is changed via the internal
+   * browser the test process's kernel has a service container with an out of
+   * date module list.
    *
    * @see TestBase::prepareEnvironment()
    * @see TestBase::restoreEnvironment()

I improved the comment. The unused $request has been bothering me for ages.

  • alexpott committed e40099f on 8.0.x
    Issue #2426735 by dawehner: Small docs improvements of WebTestBase::...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.