Skip to content
Snippets Groups Projects
Verified Commit 35441d8a authored by Frank Mably's avatar Frank Mably
Browse files

Issue #3500659 by mably: Kernel tests phpstan fixes

parent 2f337ba7
No related branches found
No related tags found
1 merge request!29Issue #3500659 by mably: Kernel tests phpstan fixes
Pipeline #399526 passed
......@@ -34,9 +34,9 @@ include:
#
variables:
OPT_IN_TEST_MAX_PHP: 1
OPT_IN_TEST_MAX_PHP: 0
OPT_IN_TEST_CURRENT: 1
OPT_IN_TEST_PREVIOUS_MINOR: 1
OPT_IN_TEST_PREVIOUS_MINOR: 0
OPT_IN_TEST_PREVIOUS_MAJOR: 1
OPT_IN_TEST_NEXT_MINOR: 1
OPT_IN_TEST_NEXT_MAJOR: 0
......@@ -152,7 +152,7 @@ abstract class KernelTestBase extends CoreKernelTestBase {
* New datasets.
* Format: $[$dataset_name . '.form'|'.cron'] = [...$args, 'cron'|'form'].
*/
protected function duplicateAndAppendPurgeMode(array $datasets): array {
protected static function duplicateAndAppendPurgeMode(array $datasets): array {
$new_datasets = [];
foreach ($datasets as $dataset_name => $dataset) {
$new_datasets["$dataset_name.cron"] = array_merge($dataset, ['cron']);
......
......@@ -150,7 +150,7 @@ class PurgeConditionTest extends KernelTestBase {
* @param string $mode
* One of 'cron' or 'form'.
*
* @dataProvider userConditionsProvider()
* @dataProvider userConditionsProvider
*/
public function testUserConditions(array $expected, array $settings, string $mode): void {
$config = $this->config('purge_users.settings');
......@@ -209,10 +209,10 @@ class PurgeConditionTest extends KernelTestBase {
* 'cron'|'form',
* ].
*/
public function userConditionsProvider(): array {
public static function userConditionsProvider(): array {
$value = 2;
$period = 'year';
return $this->duplicateAndAppendPurgeMode([
return static::duplicateAndAppendPurgeMode([
'purge_none' => [
[
// No users are purged.
......
......@@ -56,7 +56,7 @@ class PurgeMethodTest extends KernelTestBase {
* @param string $mode
* One of 'cron' or 'form'.
*
* @dataProvider providerPurgeMethod()
* @dataProvider providerPurgeMethod
*/
public function testPurgeMethod(array $expected_user_states, array $expected_node_states, array $settings, string $mode): void {
$this->config('purge_users.settings')
......@@ -136,7 +136,7 @@ class PurgeMethodTest extends KernelTestBase {
* 'cron'|'form',
* ].
*/
public function providerPurgeMethod(): array {
public static function providerPurgeMethod(): array {
$basics = [
'user_cancel_delete' => [
[
......@@ -205,7 +205,7 @@ class PurgeMethodTest extends KernelTestBase {
];
}
// Run the same tests both with cron and with web UI purge.
return $this->duplicateAndAppendPurgeMode($datasets);
return static::duplicateAndAppendPurgeMode($datasets);
}
}
......@@ -43,7 +43,7 @@ class UserIdsTest extends KernelTestBase {
*
* @throws \Drupal\Core\Entity\EntityStorageException
*
* @dataProvider userIdsByUserValuesProvider()
* @dataProvider userIdsByUserValuesProvider
*/
public function testUserIdsByUserValues(array $expected_names, string $op, array $settings): void {
$this->setSettings($settings);
......@@ -115,13 +115,13 @@ class UserIdsTest extends KernelTestBase {
* $other_settings : array, // optional.
* ].
*/
public function userIdsByUserValuesProvider(): \Iterator {
yield from $this->buildDatasets(
public static function userIdsByUserValuesProvider(): \Iterator {
yield from static::buildDatasets(
'none',
[],
[],
[]);
yield from $this->buildDatasets(
yield from static::buildDatasets(
'notify_all_purge_none',
[],
[
......@@ -157,7 +157,7 @@ class UserIdsTest extends KernelTestBase {
'user_before_notification_period' => 'month',
'send_email_user_before_notification' => TRUE,
]);
yield from $this->buildDatasets(
yield from static::buildDatasets(
'all_purge_conditions',
[
'created3y_loginNever_blocked',
......@@ -192,7 +192,7 @@ class UserIdsTest extends KernelTestBase {
'user_before_notification_period' => 'month',
'send_email_user_before_notification' => TRUE,
]);
yield from $this->buildDatasets(
yield from static::buildDatasets(
'mixed',
[
'created3y_login3y_blocked',
......@@ -214,7 +214,7 @@ class UserIdsTest extends KernelTestBase {
'user_before_notification_period' => 'month',
'send_email_user_before_notification' => TRUE,
]);
yield from $this->buildDatasets(
yield from static::buildDatasets(
'different_time_unit',
[
'created3y_login3y_blocked',
......@@ -262,7 +262,7 @@ class UserIdsTest extends KernelTestBase {
* $other_settings : array, // optional.
* ].
*/
protected function buildDatasets(
protected static function buildDatasets(
string $name,
array $names_to_purge,
array $names_to_notify,
......
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