function TestController::containerReset

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/modules/container_rebuild_test/src/TestController.php \Drupal\container_rebuild_test\TestController::containerReset()

Resets the container.

Return value

array A render array.

1 string reference to 'TestController::containerReset'
container_rebuild_test.routing.yml in core/modules/system/tests/modules/container_rebuild_test/container_rebuild_test.routing.yml
core/modules/system/tests/modules/container_rebuild_test/container_rebuild_test.routing.yml

File

core/modules/system/tests/modules/container_rebuild_test/src/TestController.php, line 53

Class

TestController

Namespace

Drupal\container_rebuild_test

Code

public function containerReset() {
  $this->messenger()
    ->addMessage(t('Before the container was reset.'));
  $this->kernel
    ->resetContainer();
  // The container has been reset, therefore we need to get the new service.
  $this->messenger = NULL;
  $this->messenger()
    ->addMessage(t('After the container was reset.'));
  return [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.