expectedShutdownCalled = ['shutdownFunction', 'shutdownFunction2']; drupal_register_shutdown_function([$this, 'shutdownFunction']); } /** * @covers ::assertPostConditions */ public function testNoShutdownFunction() { $this->expectedShutdownCalled = []; } /** * Registers that this shutdown function has been called. */ public function shutdownFunction() { self::$shutdownCalled[] = 'shutdownFunction'; drupal_register_shutdown_function([$this, 'shutdownFunction2']); } /** * Registers that this shutdown function has been called. */ public function shutdownFunction2() { self::$shutdownCalled[] = 'shutdownFunction2'; } /** * {@inheritdoc} */ protected function assertPostConditions() { parent::assertPostConditions(); $this->assertSame($this->expectedShutdownCalled, self::$shutdownCalled); } }