You are here

public function Tests::isExecutable in Drupal 7 to 8/9 Module Upgrader 8

Returns if this conversion applies to the target module. If FALSE, the convert() method will not be called.

Parameters

TargetInterface $target: The target module.

Return value

bool

Overrides ConverterBase::isExecutable

File

src/Plugin/DMU/Converter/Tests.php, line 31

Class

Tests
Plugin annotation @Converter( id = "tests", description = @Translation("Modifies test classes.") )

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Converter

Code

public function isExecutable(TargetInterface $target) {
  foreach ([
    'DrupalTestCase',
    'DrupalWebTestCase',
  ] as $parent_class) {
    if ($target
      ->getIndexer('class')
      ->getQuery()
      ->condition('parent', $parent_class)
      ->countQuery()
      ->execute()) {
      return TRUE;
    }
  }
  return FALSE;
}