Skip to content

Move phpstan_fixtures test data to tests/src/Rules/data#974

Merged
mglaman merged 6 commits intomainfrom
move-phpstan-fixtures-to-data
Apr 15, 2026
Merged

Move phpstan_fixtures test data to tests/src/Rules/data#974
mglaman merged 6 commits intomainfrom
move-phpstan-fixtures-to-data

Conversation

@mglaman
Copy link
Copy Markdown
Owner

@mglaman mglaman commented Apr 12, 2026

Summary

  • Moves rule test data files out of tests/fixtures/drupal/modules/phpstan_fixtures/ and into tests/src/Rules/data/, keeping test data co-located with the tests that use them
  • Removes 5 dead fixture files that were no longer referenced by any test (AppRootParameter, DeprecatedGlobalConstants, EntityFieldReflection/, EntityQueryHasAccessRule)
  • Extracts the loadInclude invalid case from phpstan_fixtures.module into a dedicated data file

Closes #723 (partial — remaining files like Entity/ storage classes, Internal/, and ReflectionEntityTest still need follow-up work due to namespace and reflection dependencies)

Files moved to tests/src/Rules/data/:

  • EntityQueryWithAccessRule.phpentity-query-access-check-valid.php
  • EntityQueryWithoutAccessRule.phpentity-query-access-check-invalid.php
  • Entity/ConfigWithExport.phpconfig-entity-with-export.php
  • Entity/ConfigWithoutExport.phpconfig-entity-without-export.php
  • Plugin/Condition/ConditionWithContext.phpplugin-condition-context-deprecated.php
  • Plugin/Condition/ConditionWithContextDefinitions.phpplugin-condition-context-definitions.php
  • Plugin/Action/ActionSample.phpplugin-action-sample.php
  • Plugin/Block/BlockWithContext.phpplugin-block-context-deprecated.php
  • ExamplePluginManager.phpplugin-manager-valid.php
  • UsesDeprecatedUrlFunction.phpglobal-drupal-di-deprecated-url.php
  • TestServicesMappingExtension.phpglobal-drupal-di-service-mapping.php

Test plan

  • php vendor/bin/phpunit — 770 tests pass, same as before

🤖 Generated with Claude Code

mglaman and others added 4 commits April 12, 2026 12:09
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>
@mglaman mglaman merged commit 8ddbcc3 into main Apr 15, 2026
14 of 15 checks passed
@mglaman mglaman deleted the move-phpstan-fixtures-to-data branch April 15, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move data samples out of phpstan_fixtures and into test data files

1 participant