You are here

public function UncaughtExceptionTest::testErrorContainer in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/System/UncaughtExceptionTest.php \Drupal\system\Tests\System\UncaughtExceptionTest::testErrorContainer()

Tests a container which has an error.

File

core/modules/system/src/Tests/System/UncaughtExceptionTest.php, line 169
Contains \Drupal\system\Tests\System\UncaughtExceptionTest.

Class

UncaughtExceptionTest
Tests kernel panic when things are really messed up.

Namespace

Drupal\system\Tests\System

Code

public function testErrorContainer() {
  $settings = [];
  $settings['settings']['container_base_class'] = (object) [
    'value' => '\\Drupal\\system\\Tests\\Bootstrap\\ErrorContainer',
    'required' => TRUE,
  ];
  $this
    ->writeSettings($settings);
  \Drupal::service('kernel')
    ->invalidateContainer();
  $this->expectedExceptionMessage = 'Argument 1 passed to Drupal\\system\\Tests\\Bootstrap\\ErrorContainer::Drupal\\system\\Tests\\Bootstrap\\{closur';
  $this
    ->drupalGet('');
  $this
    ->assertResponse(500);
  $this
    ->assertRaw($this->expectedExceptionMessage);
  $this
    ->assertErrorLogged($this->expectedExceptionMessage);
}