Issue #3419230 by alexpott: Drush error on site-install

merge-requests/6459/head
Dave Long 2024-02-05 13:09:00 +00:00
parent 577b6900b9
commit 63c3ce45b4
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
2 changed files with 13 additions and 1 deletions

View File

@ -695,7 +695,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
* @return void
*/
public function terminate(Request $request, Response $response) {
if ($this->getHttpKernel() instanceof TerminableInterface) {
if ($this->booted && $this->getHttpKernel() instanceof TerminableInterface) {
// Only run terminate() when essential services have been set up properly
// by preHandle() before.
if ($this->prepared === TRUE) {

View File

@ -4,12 +4,14 @@ declare(strict_types=1);
namespace Drupal\Tests\Core\DrupalKernel;
use Composer\Autoload\ClassLoader;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Test\TestKernel;
use Drupal\Tests\Core\DependencyInjection\Fixture\BarClass;
use Drupal\Tests\UnitTestCase;
use org\bovigo\vfs\vfsStream;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* @coversDefaultClass \Drupal\Core\DrupalKernel
@ -152,6 +154,16 @@ EOD;
$this->assertEquals($container->get('kernel')->getServiceIdMapping()[$container->generateServiceIdHash($service)], 'bar');
}
/**
* @covers ::terminate
* @runInSeparateProcess
*/
public function testUnBootedTerminate() {
$kernel = new DrupalKernel('test', new ClassLoader());
$kernel->terminate(new Request(), new Response());
$this->assertTrue(TRUE, "\Drupal\Core\DrupalKernel::terminate() called without error on kernel which has not booted");
}
}
/**