assertPostConditions example

/** * Registers that this shutdown function has been called. */
  public function shutdownFunction2() {
    self::$shutdownCalled[] = 'shutdownFunction2';
  }

  /** * {@inheritdoc} */
  protected function assertPostConditions(): void {
    parent::assertPostConditions();
    $this->assertSame($this->expectedShutdownCalled, self::$shutdownCalled);
  }

}
    $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\KernelTests\Core\DrupalKernel\DrupalKernelTest     if ($this->container) {
      $this->container->get('kernel')->shutdown();
    }

    parent::assertPostConditions();
  }

  /** * {@inheritdoc} */
  protected function tearDown(): void {
    // Destroy the testing kernel.     if (isset($this->kernel)) {
      $this->kernel->shutdown();
    }

    
Home | Imprint | This part of the site doesn't use cookies.