function ControllerBaseTest::testCreateException

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php \Drupal\KernelTests\Core\Controller\ControllerBaseTest::testCreateException()

@covers ::create

File

core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php, line 49

Class

ControllerBaseTest
Tests \Drupal\Core\Controller\ControllerBase.

Namespace

Drupal\KernelTests\Core\Controller

Code

public function testCreateException() : void {
    $this->expectException(AutowiringFailedException::class);
    $this->expectExceptionMessage('Cannot autowire service "Drupal\\Core\\Lock\\LockBackendInterface": argument "$lock" of method "Drupal\\system_test\\Controller\\BrokenSystemTestController::_construct()", you should configure its value explicitly.');
    $this->container
        ->get('class_resolver')
        ->getInstanceFromDefinition(BrokenSystemTestController::class);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.