You are here

private function Tests::convertInfo in Drupal 7 to 8/9 Module Upgrader 8

Converts the test's getInfo() method to an annotation.

Parameters

\Pharborist\Objects\ClassNode $test:

1 call to Tests::convertInfo()
Tests::convertWeb in src/Plugin/DMU/Converter/Tests.php
Converts a single web test.

File

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

Class

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

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Converter

Code

private function convertInfo(ClassNode $test) {
  $info = $this
    ->extractInfo($test);
  if ($info) {
    $comment = '';
    $comment .= $info['description'] . "\n\n";
    $comment .= '@group ' . $this->target
      ->id();
    if (isset($info['dependencies'])) {
      $comment .= "\n";
      foreach ($info['dependencies'] as $module) {
        $comment .= '@requires module . ' . $module . "\n";
      }
    }
    $test
      ->setDocComment(DocCommentNode::create($comment));
  }
  else {
    $this->log
      ->error('Could not get info for test {class}.', [
      'class' => $test
        ->getName(),
    ]);
  }
}