function DrupalKernelRequestStackTest::onTerminate

Throws an exception during termination when requested by a test.

Parameters

\Symfony\Component\HttpKernel\Event\TerminateEvent $event: The terminate event.

File

core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelRequestStackTest.php, line 229

Class

DrupalKernelRequestStackTest
Tests the usage of the request stack as part of request processing.

Namespace

Drupal\KernelTests\Core\DrupalKernel

Code

public function onTerminate(TerminateEvent $event) : void {
  if ($this->throwOnTerminate) {
    throw new \RuntimeException('Termination failed.');
  }
}

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