Move phpstan_fixtures test data to tests/src/Rules/data#974
Merged
Conversation
Moves rule test data files out of the phpstan_fixtures Drupal module fixture and into the standard tests/src/Rules/data/ directory, keeping test data co-located with the tests that use it. Also removes dead fixture files that were no longer referenced by any test (AppRootParameter, DeprecatedGlobalConstants, EntityFieldReflection, EntityQueryHasAccessRule). Refs #723 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the coverage that was lost when AppRootParameter.php was removed. DrupalServiceDefinition::getType() maps SplString to StringType to handle Drupal pseudo-services like 'app.root' which are strings injected into the container rather than real objects. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app.root is set programmatically by DrupalKernel::initializeContainer() as
a synthetic SplString service (not defined in any services.yml). The
DrupalAutoloader already hardcodes other synthetic services like kernel,
class_loader, and service_container — app.root belongs in the same block.
This makes the existing SplString → StringType mapping in
DrupalServiceDefinition::getType() reachable, and lets type assertions on
\Drupal::getContainer()->get('app.root') resolve to string.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app.root is a container parameter in Drupal, not a service. The SplString workaround in DrupalServiceDefinition::getType() was never reachable because nothing registered app.root as a service with class SplString. AppRootParameter.php was already removed as part of dead code cleanup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/fixtures/drupal/modules/phpstan_fixtures/and intotests/src/Rules/data/, keeping test data co-located with the tests that use themAppRootParameter,DeprecatedGlobalConstants,EntityFieldReflection/,EntityQueryHasAccessRule)loadIncludeinvalid case fromphpstan_fixtures.moduleinto a dedicated data fileCloses #723 (partial — remaining files like
Entity/storage classes,Internal/, andReflectionEntityTeststill need follow-up work due to namespace and reflection dependencies)Files moved to
tests/src/Rules/data/:EntityQueryWithAccessRule.php→entity-query-access-check-valid.phpEntityQueryWithoutAccessRule.php→entity-query-access-check-invalid.phpEntity/ConfigWithExport.php→config-entity-with-export.phpEntity/ConfigWithoutExport.php→config-entity-without-export.phpPlugin/Condition/ConditionWithContext.php→plugin-condition-context-deprecated.phpPlugin/Condition/ConditionWithContextDefinitions.php→plugin-condition-context-definitions.phpPlugin/Action/ActionSample.php→plugin-action-sample.phpPlugin/Block/BlockWithContext.php→plugin-block-context-deprecated.phpExamplePluginManager.php→plugin-manager-valid.phpUsesDeprecatedUrlFunction.php→global-drupal-di-deprecated-url.phpTestServicesMappingExtension.php→global-drupal-di-service-mapping.phpTest plan
php vendor/bin/phpunit— 770 tests pass, same as before🤖 Generated with Claude Code