You are here

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

Extracts the return value of the test's getInfo() method, if there's no logic in the method.

Parameters

\Pharborist\Objects\ClassNode $test:

Return value

array|null

1 call to Tests::extractInfo()
Tests::convertInfo in src/Plugin/DMU/Converter/Tests.php
Converts the test's getInfo() method to an annotation.

File

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

Class

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

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Converter

Code

private function extractInfo(ClassNode $test) {
  if ($test
    ->hasMethod('getInfo')) {
    $info = $test
      ->getMethod('getInfo');
    if (!$info
      ->is(new ContainsLogicFilter())) {
      return eval($info
        ->getBody()
        ->getText());
    }
  }
}