trait PluginManagerTestTrait in Purge 8.3
Testing helpers DIC plugin manager derivatives.
Hierarchy
- trait \Drupal\Tests\purge\Traits\PluginManagerTestTrait
See also
\Drupal\Tests\purge\Kernel\KernelPluginManagerTestBase
1 file declares its use of PluginManagerTestTrait
- KernelPluginManagerTestBase.php in tests/
src/ Kernel/ KernelPluginManagerTestBase.php
File
- tests/
src/ Traits/ PluginManagerTestTrait.php, line 14
Namespace
Drupal\Tests\purge\TraitsView source
trait PluginManagerTestTrait {
/**
* The name of the service as defined in services.yml.
*
* @var string
*/
protected $pluginManagerClass = '';
/**
* Instance of the service being tested, instantiated by the container.
*
* @var null|\Drupal\Component\Plugin\PluginManagerInterface
*/
protected $pluginManager;
/**
* Set up the test.
*/
public function setUp($switch_to_memory_queue = TRUE) : void {
parent::setUp($switch_to_memory_queue);
$this->pluginManager = new $this->pluginManagerClass($this->container
->get('container.namespaces'), $this->container
->get('cache.discovery'), $this->container
->get('module_handler'));
}
/**
* Test if the plugin manager complies to the basic requirements.
*/
public function testCodeContract() : void {
$this
->assertTrue($this->pluginManager instanceof $this->pluginManagerClass);
$this
->assertTrue($this->pluginManager instanceof PluginManagerInterface);
$this
->assertTrue($this->pluginManager instanceof DefaultPluginManager);
$this
->assertTrue($this->pluginManager instanceof CachedDiscoveryInterface);
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginManagerTestTrait:: |
protected | property | Instance of the service being tested, instantiated by the container. | |
PluginManagerTestTrait:: |
protected | property | The name of the service as defined in services.yml. | 8 |
PluginManagerTestTrait:: |
public | function | Set up the test. | 1 |
PluginManagerTestTrait:: |
public | function | Test if the plugin manager complies to the basic requirements. |