public function Tests::analyze in Drupal 7 to 8/9 Module Upgrader 8
Analyzes a target module and flags any issues found.
Parameters
TargetInterface $target: The target module.
Return value
\Drupal\drupalmoduleupgrader\IssueInterface[]
Overrides AnalyzerInterface::analyze
File
- src/
Plugin/ DMU/ Analyzer/ Tests.php, line 49
Class
- Tests
- Plugin annotation @Analyzer( id = "tests", description = @Translation("Checks for test classes that need to be rejiggered for Drupal 8."), documentation = { { "url" = "https://www.drupal.org/node/1543796", "title" =…
Namespace
Drupal\drupalmoduleupgrader\Plugin\DMU\AnalyzerCode
public function analyze(TargetInterface $target) {
$issues = [];
$total = 0;
$total += $target
->getIndexer('class')
->getQuery()
->condition('parent', 'DrupalWebTestCase')
->countQuery()
->execute()
->fetchField();
$total += $target
->getIndexer('class')
->getQuery()
->condition('parent', 'DrupalUnitTestCase')
->countQuery()
->execute()
->fetchField();
$total += $target
->getIndexer('class')
->getQuery()
->condition('parent', 'DrupalTestBase')
->countQuery()
->execute()
->fetchField();
if ($total) {
$issues[] = $this
->buildIssue($target);
}
return $issues;
}