Skip to content
Snippets Groups Projects
Verified Commit 0e38c5f4 authored by Dave Long's avatar Dave Long
Browse files

Issue #3355795 by mondrake, smustgrave, Spokje:...

Issue #3355795 by mondrake, smustgrave, Spokje: Test::parseTestMethodAnnotations is removed in PHPUnit 10
parent cf174d10
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
use Drupal\migrate\Plugin\MigrateIdMapInterface; use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row; use Drupal\migrate\Row;
use PHPUnit\Util\Test;
/** /**
* Base class for tests of Migrate source plugins. * Base class for tests of Migrate source plugins.
...@@ -78,13 +77,9 @@ protected function setUp(): void { ...@@ -78,13 +77,9 @@ protected function setUp(): void {
* @return string * @return string
*/ */
protected function getPluginClass() { protected function getPluginClass() {
$annotations = Test::parseTestMethodAnnotations( $covers = $this->getTestClassCovers();
static::class, if (!empty($covers)) {
$this->name() return $covers[0];
);
if (isset($annotations['class']['covers'])) {
return $annotations['class']['covers'][0];
} }
else { else {
$this->fail('No plugin class was specified'); $this->fail('No plugin class was specified');
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
namespace Drupal\TestTools\PhpUnitCompatibility\PhpUnit9; namespace Drupal\TestTools\PhpUnitCompatibility\PhpUnit9;
use PHPUnit\Util\Test;
/** /**
* Drupal's forward compatibility layer with multiple versions of PHPUnit. * Drupal's forward compatibility layer with multiple versions of PHPUnit.
*/ */
...@@ -16,4 +18,15 @@ public function name(): string { ...@@ -16,4 +18,15 @@ public function name(): string {
return $this->getName(); return $this->getName();
} }
/**
* Gets @covers defined on the test class.
*
* @return string[]
* An array of classes listed with the @covers annotation.
*/
public function getTestClassCovers(): array {
$annotations = Test::parseTestMethodAnnotations(static::class, $this->name());
return $annotations['class']['covers'] ?? [];
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment