function UncaughtExceptionTest::testErrorContainer
Same name in other branches
- 9 core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php \Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest::testErrorContainer()
- 8.9.x core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php \Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest::testErrorContainer()
- 10 core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php \Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest::testErrorContainer()
Tests a container which has an error.
File
-
core/
tests/ Drupal/ FunctionalTests/ Bootstrap/ UncaughtExceptionTest.php, line 158
Class
- UncaughtExceptionTest
- Tests kernel panic when things are really messed up.
Namespace
Drupal\FunctionalTests\BootstrapCode
public function testErrorContainer() : void {
$settings = [];
$settings['settings']['container_base_class'] = (object) [
'value' => '\\Drupal\\FunctionalTests\\Bootstrap\\ErrorContainer',
'required' => TRUE,
];
$this->writeSettings($settings);
\Drupal::service('kernel')->invalidateContainer();
$this->expectedExceptionMessage = PHP_VERSION_ID >= 80400 ? 'Drupal\\FunctionalTests\\Bootstrap\\ErrorContainer::{closure:Drupal\\FunctionalTests\\Bootstrap\\ErrorContainer::get():21}(): Argument #1 ($container) must be of type Drupal\\FunctionalTests\\Bootstrap\\ErrorContainer' : 'Drupal\\FunctionalTests\\Bootstrap\\ErrorContainer::Drupal\\FunctionalTests\\Bootstrap\\{closure}(): Argument #1 ($container) must be of type Drupal\\FunctionalTests\\Bootstrap\\ErrorContainer';
$this->drupalGet('');
$this->assertSession()
->statusCodeEquals(500);
$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.