Unverified Commit adc897b7 authored by alexpott's avatar alexpott

Issue #3186443 by tuutti, marcelovani: PHPUnit 9.5 Call to undefined method ::getAnnotations()

(cherry picked from commit 754b8ffa)
parent 8146809d
......@@ -6,6 +6,7 @@
use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row;
use PHPUnit\Util\Test;
/**
* Base class for tests of Migrate source plugins.
......@@ -77,7 +78,10 @@ protected function setUp() {
* @return string
*/
protected function getPluginClass() {
$annotations = $this->getAnnotations();
$annotations = Test::parseTestMethodAnnotations(
static::class,
$this->getName()
);
if (isset($annotations['class']['covers'])) {
return $annotations['class']['covers'][0];
......
......@@ -6,6 +6,7 @@
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestSuite;
use PHPUnit\Util\ErrorHandler;
use PHPUnit\Util\Test;
/**
* Listens for PHPUnit tests and fails those with invalid coverage annotations.
......@@ -60,7 +61,10 @@ private function checkValidCoversForTest(TestCase $test) {
return;
}
// Gather our annotations.
$annotations = $test->getAnnotations();
$annotations = Test::parseTestMethodAnnotations(
static::class,
$test->getName()
);
// Glean the @coversDefaultClass annotation.
$default_class = '';
$valid_default_class = FALSE;
......
......@@ -51,7 +51,10 @@ protected function checkRequirements() {
$root = static::getDrupalRoot();
// Check if required dependencies exist.
$annotations = $this->getAnnotations();
$annotations = Test::parseTestMethodAnnotations(
static::class,
$this->getName()
);
if (!empty($annotations['class']['requires'])) {
$this->checkModuleRequirements($root, $annotations['class']['requires']);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment