TestContainerDerivativeDiscovery.php

Same filename in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Plugin/Discovery/TestContainerDerivativeDiscovery.php
  2. 10 core/tests/Drupal/Tests/Core/Plugin/Discovery/TestContainerDerivativeDiscovery.php
  3. 11.x core/tests/Drupal/Tests/Core/Plugin/Discovery/TestContainerDerivativeDiscovery.php

Namespace

Drupal\Tests\Core\Plugin\Discovery

File

core/tests/Drupal/Tests/Core/Plugin/Discovery/TestContainerDerivativeDiscovery.php

View source
<?php

namespace Drupal\Tests\Core\Plugin\Discovery;

use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

/**
 * Defines container test derivative discovery.
 */
class TestContainerDerivativeDiscovery extends TestDerivativeDiscovery implements ContainerDeriverInterface {
    
    /**
     * Constructs a TestContainerDerivativeDiscovery object.
     *
     * @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $example_service
     *   Some service.
     */
    public function __construct(EventDispatcherInterface $example_service) {
    }
    
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container, $base_plugin_id) {
        return new static($container->get('example_service'));
    }

}

Classes

Title Deprecated Summary
TestContainerDerivativeDiscovery Defines container test derivative discovery.

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