function MigrateSourceTestBase::getPluginClass

Determines the plugin to be tested.

This is identified by the first #[CoverClass] attribute set on the concrete test class.

Return value

string The fully qualified class name of the plugin to be tested.

1 call to MigrateSourceTestBase::getPluginClass()
MigrateSourceTestBase::getPlugin in core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php
Instantiates the source plugin under test.

File

core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php, line 91

Class

MigrateSourceTestBase
Base class for tests of Migrate source plugins.

Namespace

Drupal\Tests\migrate\Kernel

Code

protected function getPluginClass() {
  $coversClass = $this->valueObjectForEvents()
    ->metadata()
    ->isCoversClass()
    ->isClassLevel()
    ->asArray();
  if (isset($coversClass[0])) {
    return $coversClass[0]->className();
  }
  $covers = $this->valueObjectForEvents()
    ->metadata()
    ->isCovers()
    ->isClassLevel()
    ->asArray();
  if (isset($covers[0])) {
    return $covers[0]->target();
  }
  $this->fail('No plugin class was specified');
}

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