Skip to content

Commit a8b25cc

Browse files
authored
Allow PHPUnit 10, 11 for Drupal 11 testing (#761)
* Allow PHPUnit 10, 11 for Drupal 11 testing * phpunit deprecations * update tests
1 parent 2e8bb49 commit a8b25cc

34 files changed

+46
-47
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"drush/drush": "^10.0 || ^11 || ^12 || ^13@beta",
2525
"phpstan/extension-installer": "^1.1",
2626
"phpstan/phpstan-strict-rules": "^1.0",
27-
"phpunit/phpunit": "^8.5 || ^9",
27+
"phpunit/phpunit": "^8.5 || ^9 || ^10 || ^11",
2828
"slevomat/coding-standard": "^7.1",
2929
"squizlabs/php_codesniffer": "^3.3",
3030
"symfony/phpunit-bridge": "^4.4 || ^5.4 || ^6.0 || ^7.0"

tests/src/Drupal/ExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function testDependencies(array $dependencies, string $pathInfoFile): voi
1919
);
2020
}
2121

22-
public function dependenciesProvider(): \Generator
22+
public static function dependenciesProvider(): \Generator
2323
{
2424
yield [
2525
[

tests/src/DrupalAutoloadingTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testAnalyze(array $paths, array $errorMessages): void
2121
}
2222

2323

24-
public function dataFixtures(): \Generator
24+
public static function dataFixtures(): \Generator
2525
{
2626
yield [
2727
[__DIR__ . '/../fixtures/drupal/modules/service_provider_test/src/ServiceProviderTestServiceProvider.php'],
@@ -50,7 +50,6 @@ public function dataFixtures(): \Generator
5050
__DIR__ . '/../fixtures/drupal/modules/module_with_tests/tests/src/Traits/ModuleWithTestsTrait.php',
5151
__DIR__ . '/../fixtures/drupal/modules/module_with_tests/tests/src/TestSite/ModuleWithTestsTestSite.php',
5252
// __DIR__ . '/../fixtures/drupal/modules/module_with_tests/tests/src/Kernel/DrupalStaticCallTest.php',
53-
__DIR__ . '/../fixtures/drupal/core/tests/TestSuites/TestSuiteBase.php',
5453
],
5554
[]
5655
];

tests/src/Reflection/EntityFieldMethodsViaMagicReflectionExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testHasMethod(string $class, string $method, bool $result): void
3636
self::assertEquals($result, $this->extension->hasMethod($reflection, $method));
3737
}
3838

39-
public function dataHasMethod(): \Generator
39+
public static function dataHasMethod(): \Generator
4040
{
4141
// Technically it does not have this method. But we allow it for now.
4242
yield 'field item list: referencedEntities' => [

tests/src/Reflection/EntityFieldsViaMagicReflectionExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testHasProperty(string $class, string $property, bool $result):
4040
self::assertEquals($result, $this->extension->hasProperty($reflection, $property));
4141
}
4242

43-
public function dataHasProperty(): \Generator
43+
public static function dataHasProperty(): \Generator
4444
{
4545
yield 'content entity supported' => [
4646
// @phpstan-ignore-next-line

tests/src/Rules/BrowserTestBaseDefaultThemeRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testRule(string $path, array $errorMessages): void
2626
);
2727
}
2828

29-
public function fileData(): \Generator
29+
public static function fileData(): \Generator
3030
{
3131
yield [
3232
__DIR__ . '/../../fixtures/drupal/modules/module_with_tests/tests/src/Functional/MissingDefaultThemeTest.php',

tests/src/Rules/ClassExtendsInternalClassRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testRule(string $path, array $errorMessages): void
4949
$this->analyse([$path], $errorMessages);
5050
}
5151

52-
public function pluginData(): \Generator
52+
public static function pluginData(): \Generator
5353
{
5454
yield 'extends an internal class from a non-shared namespace: phpstan_fixtures extends an internal class from Drupal core.' => [
5555
__DIR__ . '/../../fixtures/drupal/modules/phpstan_fixtures/src/Internal/ExtendsDrupalCoreInternalClass.php',

tests/src/Rules/ConfigEntityConfigExportRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function testConfigExportRuleCheck(string $path, array $errorMessages): v
2222
$this->analyse([$path], $errorMessages);
2323
}
2424

25-
public function pluginData(): \Generator
25+
public static function pluginData(): \Generator
2626
{
2727
yield [
2828
__DIR__ . '/../../fixtures/drupal/modules/phpstan_fixtures/src/Entity/ConfigWithoutExport.php',

tests/src/Rules/EntityQueryHasAccessCheckRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function test(array $files, array $errors): void
2222
$this->analyse($files, $errors);
2323
}
2424

25-
public function cases(): \Generator
25+
public static function cases(): \Generator
2626
{
2727
yield [
2828
[__DIR__.'/../../fixtures/drupal/modules/phpstan_fixtures/src/EntityQueryWithAccessRule.php'],

tests/src/Rules/GetDeprecatedServiceRuleTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testRuleDrupal9(string $path, array $errorMessages): void
4040
$this->analyse([$path], $errorMessages);
4141
}
4242

43-
public function drupal8Data(): \Generator
43+
public static function drupal8Data(): \Generator
4444
{
4545
yield [
4646
__DIR__ . '/../../fixtures/drupal/modules/phpstan_fixtures/src/Plugin/Block/EntityManagerInjectedBlock.php',
@@ -62,7 +62,7 @@ public function drupal8Data(): \Generator
6262
];
6363
}
6464

65-
public function drupal9Data(): \Generator
65+
public static function drupal9Data(): \Generator
6666
{
6767
yield [
6868
__DIR__ . '/../../fixtures/drupal/modules/phpstan_fixtures/phpstan_fixtures.module',

0 commit comments

Comments
 (0)