You are here

protected function TestBase::getPlugin in Drupal 7 to 8/9 Module Upgrader 8

Instantiates the plugin class covered by this test (as indicated by the @covers annotation). The plugin instance is given a randomly generated ID and description. Dependencies will be pulled from $this->container, so this should only be called once the mock container is ready.

Parameters

array $configuration: Additional configuration to pass to the instance.

array $plugin_definition: Additional definition info to pass to the instance.

Return value

object A plugin instance.

7 calls to TestBase::getPlugin()
AnalyzerTestBase::getPlugin in tests/src/Unit/Plugin/DMU/Analyzer/AnalyzerTestBase.php
Instantiates the plugin class covered by this test (as indicated by the @covers annotation). The plugin instance is given a randomly generated ID and description. Dependencies will be pulled from $this->container, so this should only be called once…
DBTest::setUp in tests/src/Unit/Plugin/DMU/Converter/Functions/DBTest.php
Mocks an entire module, called foo, in a virtual file system.
DisableTest::setUp in tests/src/Unit/Plugin/DMU/Converter/Functions/DisableTest.php
Mocks an entire module, called foo, in a virtual file system.
DrupalGetTitleTest::setUp in tests/src/Unit/Plugin/DMU/Converter/Functions/DrupalGetTitleTest.php
Mocks an entire module, called foo, in a virtual file system.
FormStateTest::setUp in tests/src/Unit/Plugin/DMU/Rewriter/FormStateTest.php
Mocks an entire module, called foo, in a virtual file system.

... See full list

1 method overrides TestBase::getPlugin()
AnalyzerTestBase::getPlugin in tests/src/Unit/Plugin/DMU/Analyzer/AnalyzerTestBase.php
Instantiates the plugin class covered by this test (as indicated by the @covers annotation). The plugin instance is given a randomly generated ID and description. Dependencies will be pulled from $this->container, so this should only be called once…

File

tests/src/Unit/TestBase.php, line 77

Class

TestBase
Base class for all DMU tests, providing a useful environment:

Namespace

Drupal\Tests\drupalmoduleupgrader\Unit

Code

protected function getPlugin(array $configuration = [], $plugin_definition = []) {
  $plugin_definition['description'] = $this
    ->getRandomGenerator()
    ->sentences(4);
  $class = $this->info['class']['covers'][0];
  return $class::create($this->container, $configuration, $this
    ->randomMachineName(), $plugin_definition);
}