Verified Commit c1d51a81 authored by Dave Long's avatar Dave Long
Browse files

fix: #3554801 The exception thrown by...

fix: #3554801 The exception thrown by AutowiredInstanceTrait::createInstanceAutowired() uses the wrong name for the constructor

By: avpaderno
By: idebr
(cherry picked from commit 3ecd3c65)
parent 268d3abb
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public static function createInstanceAutowired(ContainerInterface $container, mi
            $args[] = NULL;
            continue;
          }
          throw new AutowiringFailedException($service, sprintf('Cannot autowire service "%s": argument "$%s" of method "%s::_construct()", you should configure its value explicitly.', $service, $parameter->getName(), static::class));
          throw new AutowiringFailedException($service, sprintf('Cannot autowire service "%s": argument "$%s" of method "%s::__construct()", you should configure its value explicitly.', $service, $parameter->getName(), static::class));
        }

        $args[] = $container->get($service);
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public function testAutowireBlock(): void {
   */
  public function testAutowireError(): void {
    $this->expectException(AutowiringFailedException::class);
    $this->expectExceptionMessage('Cannot autowire service "Drupal\Core\Lock\LockBackendInterface": argument "$lock" of method "Drupal\autowire_test\Plugin\Block\AutowireErrorBlock::_construct()", you should configure its value explicitly.');
    $this->expectExceptionMessage('Cannot autowire service "Drupal\Core\Lock\LockBackendInterface": argument "$lock" of method "Drupal\autowire_test\Plugin\Block\AutowireErrorBlock::__construct()", you should configure its value explicitly.');

    \Drupal::service('plugin.manager.block')->createInstance('autowire_error');
  }
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ public function testCreate(): void {
   */
  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->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);
  }