You are here

public function UncaughtExceptionTest::testMissingDependency 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::testMissingDependency()

Tests a missing dependency on a service.

File

core/modules/system/src/Tests/System/UncaughtExceptionTest.php, line 119
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 testMissingDependency() {
  $this->expectedExceptionMessage = 'Argument 1 passed to Drupal\\error_service_test\\LonelyMonkeyClass::__construct() must be an instance of Drupal\\Core\\Database\\Connection, non';
  $this
    ->drupalGet('broken-service-class');
  $this
    ->assertResponse(500);
  $this
    ->assertRaw('The website encountered an unexpected error.');
  $this
    ->assertRaw($this->expectedExceptionMessage);
  $this
    ->assertErrorLogged($this->expectedExceptionMessage);
}