Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ExtensionBootstrapper.php

class ExtensionBootstrapper

@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

@internal This class is not covered by the backward compatibility promise for PHPUnit

Hierarchy

  • class \PHPUnit\Runner\Extension\ExtensionBootstrapper

Expanded class hierarchy of ExtensionBootstrapper

1 file declares its use of ExtensionBootstrapper
Application.php in vendor/phpunit/phpunit/src/TextUI/Application.php

File

vendor/phpunit/phpunit/src/Runner/Extension/ExtensionBootstrapper.php, line 28

Namespace

PHPUnit\Runner\Extension
View source
final class ExtensionBootstrapper {
    private readonly Configuration $configuration;
    private readonly Facade $facade;
    public function __construct(Configuration $configuration, Facade $facade) {
        $this->configuration = $configuration;
        $this->facade = $facade;
    }
    
    /**
     * @psalm-param class-string $className
     * @psalm-param array<string, string> $parameters
     */
    public function bootstrap(string $className, array $parameters) : void {
        if (!class_exists($className)) {
            EventFacade::emitter()->testRunnerTriggeredWarning(sprintf('Cannot bootstrap extension because class %s does not exist', $className));
            return;
        }
        if (!in_array(Extension::class, class_implements($className), true)) {
            EventFacade::emitter()->testRunnerTriggeredWarning(sprintf('Cannot bootstrap extension because class %s does not implement interface %s', $className, Extension::class));
            return;
        }
        try {
            $instance = (new ReflectionClass($className))->newInstance();
            assert($instance instanceof Extension);
            $instance->bootstrap($this->configuration, $this->facade, ParameterCollection::fromArray($parameters));
        } catch (Throwable $t) {
            EventFacade::emitter()->testRunnerTriggeredWarning(sprintf('Bootstrapping of extension %s failed: %s%s%s', $className, $t->getMessage(), PHP_EOL, $t->getTraceAsString()));
            return;
        }
        EventFacade::emitter()->testRunnerBootstrappedExtension($className, $parameters);
    }

}

Members

Title Sort descending Modifiers Object type Summary
ExtensionBootstrapper::$configuration private property
ExtensionBootstrapper::$facade private property
ExtensionBootstrapper::bootstrap public function @psalm-param class-string $className
@psalm-param array&lt;string, string&gt; $parameters
ExtensionBootstrapper::__construct public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal