function UncaughtExceptionTest::testExceptionContainer
Same name in other branches
- 9 core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php \Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest::testExceptionContainer()
- 8.9.x core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php \Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest::testExceptionContainer()
- 10 core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php \Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest::testExceptionContainer()
Tests a container which has an exception really early.
File
-
core/
tests/ Drupal/ FunctionalTests/ Bootstrap/ UncaughtExceptionTest.php, line 169
Class
- UncaughtExceptionTest
- Tests kernel panic when things are really messed up.
Namespace
Drupal\FunctionalTests\BootstrapCode
public function testExceptionContainer() : void {
$settings = [];
$settings['settings']['container_base_class'] = (object) [
'value' => '\\Drupal\\FunctionalTests\\Bootstrap\\ExceptionContainer',
'required' => TRUE,
];
$this->writeSettings($settings);
\Drupal::service('kernel')->invalidateContainer();
$this->expectedExceptionMessage = 'Thrown exception during Container::get';
$this->drupalGet('');
$this->assertSession()
->statusCodeEquals(500);
$this->assertSession()
->pageTextContains('The website encountered an unexpected error');
$this->assertSession()
->pageTextContains($this->expectedExceptionMessage);
$this->assertErrorLogged($this->expectedExceptionMessage);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.