You are here

protected function KernelTestBase::assertPostConditions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::assertPostConditions()

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 604
Contains \Drupal\KernelTests\KernelTestBase.

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected function assertPostConditions() {

  // Execute registered Drupal shutdown functions prior to tearing down.
  // @see _drupal_shutdown_function()
  $callbacks =& drupal_register_shutdown_function();
  while ($callback = array_shift($callbacks)) {
    call_user_func_array($callback['callback'], $callback['arguments']);
  }

  // Shut down the kernel (if bootKernel() was called).
  // @see \Drupal\system\Tests\DrupalKernel\DrupalKernelTest
  if ($this->container) {
    $this->container
      ->get('kernel')
      ->shutdown();
  }

  // Fail in case any (new) shutdown functions exist.
  $this
    ->assertCount(0, drupal_register_shutdown_function(), 'Unexpected Drupal shutdown callbacks exist after running shutdown functions.');
  parent::assertPostConditions();
}