Skip to content
Snippets Groups Projects
Verified Commit 63c3ce45 authored by Dave Long's avatar Dave Long
Browse files

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

parent 577b6900
No related branches found
No related tags found
No related merge requests found
...@@ -695,7 +695,7 @@ public function getServiceProviders($origin) { ...@@ -695,7 +695,7 @@ public function getServiceProviders($origin) {
* @return void * @return void
*/ */
public function terminate(Request $request, Response $response) { 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 // Only run terminate() when essential services have been set up properly
// by preHandle() before. // by preHandle() before.
if ($this->prepared === TRUE) { if ($this->prepared === TRUE) {
......
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
namespace Drupal\Tests\Core\DrupalKernel; namespace Drupal\Tests\Core\DrupalKernel;
use Composer\Autoload\ClassLoader;
use Drupal\Core\DrupalKernel; use Drupal\Core\DrupalKernel;
use Drupal\Core\Test\TestKernel; use Drupal\Core\Test\TestKernel;
use Drupal\Tests\Core\DependencyInjection\Fixture\BarClass; use Drupal\Tests\Core\DependencyInjection\Fixture\BarClass;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/** /**
* @coversDefaultClass \Drupal\Core\DrupalKernel * @coversDefaultClass \Drupal\Core\DrupalKernel
...@@ -152,6 +154,16 @@ public function testGetServiceIdMapping() { ...@@ -152,6 +154,16 @@ public function testGetServiceIdMapping() {
$this->assertEquals($container->get('kernel')->getServiceIdMapping()[$container->generateServiceIdHash($service)], 'bar'); $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");
}
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment