Skip to content

Commit 1f803a2

Browse files
authored
Merge pull request #231 from mglaman/defaultthemerule-testing-only
Only error on defaultTheme for testing profiles
2 parents 6378bf4 + 7fde314 commit 1f803a2

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/Rules/Drupal/Tests/BrowserTestBaseDefaultThemeRule.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ public function processNode(Node $node, Scope $scope): array
3939
return [];
4040
}
4141
$defaultProperties = $reflection->getNativeReflection()->getDefaultProperties();
42+
$profile = $defaultProperties['profile'] ?? null;
43+
44+
$testingProfilesWithoutThemes = [
45+
'testing',
46+
'nightwatch_testing',
47+
'testing_config_overrides',
48+
'testing_missing_dependencies',
49+
'testing_multilingual',
50+
'testing_multilingual_with_english',
51+
'testing_requirements',
52+
];
53+
if ($profile !== null && !in_array($profile, $testingProfilesWithoutThemes, true)) {
54+
return [];
55+
}
56+
4257
$defaultTheme = $defaultProperties['defaultTheme'] ?? null;
4358

4459
if ($defaultTheme === null || $defaultTheme === '') {

tests/src/Rules/BrowserTestBaseDefaultThemeRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public function fileData(): \Generator
4141
__DIR__ . '/../../fixtures/drupal/modules/module_with_tests/tests/src/Functional/DefaultThemeTest.php',
4242
[]
4343
];
44+
yield [
45+
__DIR__ . '/../../fixtures/drupal/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php',
46+
[]
47+
];
4448
yield [
4549
__DIR__ . '/../../fixtures/drupal/modules/module_with_tests/tests/src/Functional/ExtendsDefaultThemeTest.php',
4650
[]

0 commit comments

Comments
 (0)