Issue #3526823 by hydra: Fix failing PHPUnit tests and code quality checks

Repair the unit/kernel test suite which had drifted from the current source, and clean up phpcs/phpstan so the full pipeline passes.

Tests:

  • GroupSitesBaseTest: update the anonymous plugin subclass for the 12-argument constructor (currentUser, groupRelationTypeManager), mock GroupRelationshipStorageInterface, satisfy the eager assert() message in parent::addContent(), and fix the queryAlter gid placeholder and getDefinition() argument expectations.
  • SitesGroupServiceTest: mock GroupRelationInterface (which exposes getPluginDefinition()) instead of the definition interface, mock the concrete SitesService for getEntityFromRouteMatch(), and fix the cache and non-content-entity assertions.
  • GroupSitesDeriverTest: derivative id separator is now "__"; settings are nested and group ids are integer array keys.
  • GroupFromSiteContextTest: provide a container with a stubbed typed data manager so the Context value resolves.

Code quality:

  • CanonicalSiteAccessControl: inject sites.service instead of calling \Drupal::service(), and drop dead commented-out code.
  • Make GroupSites deriver final; ignore the standard new static() factory in GroupSitesBase::create().
  • Docblock, unused-variable and comment fixes across .install, .deploy.php and .module.

Closes #3526823

Merge request reports

Loading