| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/enoikio/core/tests/Drupal/KernelTests/ |
Upload File : |
<?php
namespace Drupal\KernelTests;
/**
* @coversDefaultClass \Drupal\KernelTests\KernelTestBase
*
* @group PHPUnit
* @group Test
* @group KernelTests
*/
class KernelTestBaseShutdownTest extends KernelTestBase {
/**
* Indicates which shutdown functions are expected to be called.
*
* @var array
*/
protected $expectedShutdownCalled;
/**
* Indicates which shutdown functions have been called.
*
* @var array
*/
protected static $shutdownCalled;
/**
* {@inheritdoc}
*/
protected function setUp() {
// Initialize static variable prior to testing.
self::$shutdownCalled = [];
parent::setUp();
}
/**
* @covers ::assertPostConditions
*/
public function testShutdownFunction() {
$this->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);
}
}