You are here

public function UncaughtExceptionTest::testMissingDependency in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php \Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest::testMissingDependency()
  2. 9 core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php \Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest::testMissingDependency()

Tests a missing dependency on a service.

File

core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php, line 136

Class

UncaughtExceptionTest
Tests kernel panic when things are really messed up.

Namespace

Drupal\FunctionalTests\Bootstrap

Code

public function testMissingDependency() {
  $this->expectedExceptionMessage = 'Too few arguments to function Drupal\\error_service_test\\LonelyMonkeyClass::__construct(), 0 passed';
  $this
    ->drupalGet('broken-service-class');
  $this
    ->assertSession()
    ->statusCodeEquals(500);
  $this
    ->assertSession()
    ->pageTextContains('The website encountered an unexpected error.');
  $this
    ->assertSession()
    ->pageTextContains($this->expectedExceptionMessage);
  $this
    ->assertErrorLogged($this->expectedExceptionMessage);
}