localgovdrupal / localgov_microsites_group

LocalGov Drupal Microsites Group integration
1 stars 2 forks source link

group_sites phpunit test errors #511

Open millnut opened 1 week ago

millnut commented 1 week ago

See: https://github.com/localgovdrupal/localgov_microsites_group/actions/runs/11459008595/job/31882691694

ParaTest v6.11.1 upon PHPUnit 9.6.21 by Sebastian Bergmann and contributors.

......................E.EEE.....                                  32 / 32 (100%)

Time: 12:35.426, Memory: 10.00 MB

There were 4 errors:

1) Drupal\Tests\localgov_microsites_group\Kernel\GroupDefaultContentTest::testGenerate
TypeError: Symfony\Component\DependencyInjection\ContainerBuilder::get(): Argument #1 ($id) must be of type string, null given, called in /var/www/html/web/modules/contrib/group_sites/src/Access/GroupSitesAccessPolicy.php on line 102

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:525
/var/www/html/web/modules/contrib/group_sites/src/Access/GroupSitesAccessPolicy.php:102
/var/www/html/web/modules/contrib/group_sites/src/Access/GroupSitesAccessPolicy.php:70
/var/www/html/web/modules/contrib/flexible_permissions/src/ChainPermissionCalculator.php:155
/var/www/html/web/modules/contrib/group/src/Access/GroupPermissionCalculator.php:39
/var/www/html/web/modules/contrib/group/src/QueryAccess/GroupQueryAlter.php:40
/var/www/html/web/modules/contrib/group/src/QueryAccess/QueryAlterBase.php:143
/var/www/html/web/modules/contrib/group/group.module:333
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:552
/var/www/html/web/core/lib/Drupal/Core/Database/Query/Select.php:494
/var/www/html/web/core/lib/Drupal/Core/Database/Query/Select.php:519
/var/www/html/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php:272
/var/www/html/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php:85
/var/www/html/web/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php:391
/var/www/html/web/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraintValidator.php:133
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:202
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:154
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:164
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:106
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php:93
/var/www/html/web/core/lib/Drupal/Core/TypedData/TypedData.php:132
/var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php:518
/var/www/html/web/modules/contrib/group/src/Entity/GroupMembershipTrait.php:25
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:528
/var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:753
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:483
/var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:806
/var/www/html/web/modules/contrib/group/src/Entity/Group.php:147
/var/www/html/web/modules/contrib/group/src/Entity/Group.php:183
/var/www/html/web/modules/contrib/group/src/Entity/Group.php:371
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:563
/var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:781
/var/www/html/web/modules/contrib/group/group.module:333
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:552
/var/www/html/web/core/lib/Drupal/Core/Database/Query/Select.php:494
/var/www/html/web/core/lib/Drupal/Core/Database/Query/Select.php:519
/var/www/html/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php:272
/var/www/html/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php:85
/var/www/html/web/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php:391
/var/www/html/web/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraintValidator.php:133
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:202
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:154
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:164
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:106
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php:93
/var/www/html/web/core/lib/Drupal/Core/TypedData/TypedData.php:132
/var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php:518
/var/www/html/web/modules/contrib/group/src/Entity/GroupMembershipTrait.php:25
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:528
/var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:753
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:483
/var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:806
/var/www/html/web/modules/contrib/group/src/Entity/Group.php:147
/var/www/html/web/modules/contrib/group/src/Entity/Group.php:183
/var/www/html/web/modules/contrib/group/src/Entity/Group.php:371
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:563
/var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:781
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:489
/var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:806
/var/www/html/web/modules/contrib/group/tests/src/Traits/GroupTestTrait.php:39
/var/www/html/web/modules/contrib/localgov_microsites_group/tests/src/Kernel/ContentTypeHelperTest.php:117
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:729

4) Drupal\Tests\localgov_microsites_group\Kernel\ContentTypeHelperTest::testModulesList
TypeError: Symfony\Component\DependencyInjection\ContainerBuilder::get(): Argument #1 ($id) must be of type string, null given, called in /var/www/html/web/modules/contrib/group_sites/src/Access/GroupSitesAccessPolicy.php on line 102

/var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:525
/var/www/html/web/modules/contrib/group_sites/src/Access/GroupSitesAccessPolicy.php:102
/var/www/html/web/modules/contrib/group_sites/src/Access/GroupSitesAccessPolicy.php:70
/var/www/html/web/modules/contrib/flexible_permissions/src/ChainPermissionCalculator.php:155
/var/www/html/web/modules/contrib/group/src/Access/GroupPermissionCalculator.php:39
/var/www/html/web/modules/contrib/group/src/QueryAccess/GroupQueryAlter.php:40
/var/www/html/web/modules/contrib/group/src/QueryAccess/QueryAlterBase.php:143
/var/www/html/web/modules/contrib/group/group.module:333
/var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:552
/var/www/html/web/core/lib/Drupal/Core/Database/Query/Select.php:494
/var/www/html/web/core/lib/Drupal/Core/Database/Query/Select.php:519
/var/www/html/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php:272
/var/www/html/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php:85
/var/www/html/web/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php:391
/var/www/html/web/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraintValidator.php:133
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:202
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:154
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:164
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:106
/var/www/html/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php:93
/var/www/html/web/core/lib/Drupal/Core/TypedData/TypedData.php:132
/var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php:518
/var/www/html/web/modules/contrib/group/src/Entity/GroupMembershipTrait.php:25
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:528
/var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:753
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:483
/var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:806
/var/www/html/web/modules/contrib/group/src/Entity/Group.php:147
/var/www/html/web/modules/contrib/group/src/Entity/Group.php:183
/var/www/html/web/modules/contrib/group/src/Entity/Group.php:371
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:563
/var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:781
/var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:489
/var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:806
/var/www/html/web/modules/contrib/group/tests/src/Traits/GroupTestTrait.php:39
/var/www/html/web/modules/contrib/localgov_microsites_group/tests/src/Kernel/ContentTypeHelperTest.php:117
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:729

Comparing the last working tests and when this started failing on run (19th Oct) https://github.com/localgovdrupal/localgov_microsites_project/actions/runs/11415200204 the only composer differences are;

WORKING WORKFLOW
drupal/flexible_permissions (1.1.0)
drupal/group (3.2.2)
drupal/variationcache (1.5.0)
FAILED WORKFLOW
drupal/flexible_permissions (2.0.1)
drupal/group (3.3.0)
drupal/variationcache (removed)
finnlewis commented 1 day ago

image

justsayin

millnut commented 1 day ago

Started to look at drupal/group_sites as the errors seem to come from there, looks like it has a recent dev version but haven't tested with this yet

finnlewis commented 1 day ago

Just tested the dev version of group_sites, no change, still generates the error.

1) Drupal\Tests\localgov_microsites_group\Kernel\GroupDefaultContentTest::testGenerate
TypeError: Symfony\Component\DependencyInjection\ServiceLocator::get(): Argument #1 ($id) must be of type string, null given, called in /var/www/html/web/modules/contrib/group_sites/src/Access/GroupSitesAccessPolicy.php on line 102

I'm just testing with one test for now :

$ ddev phpunit web/modules/contrib/localgov_microsites_group/tests/src/Kernel/GroupDefaultContentTest.php

finnlewis commented 1 day ago

So why is this line not getting an access_policy_id?

https://git.drupalcode.org/project/group_sites/-/blob/1.0.x/src/Access/GroupSitesAccessPolicy.php?ref_type=heads#L101

finnlewis commented 1 day ago

Debugging the phpunit test, (kernal test)

$this->configFactory->get('group_sites.settings');

returns an empty config object.

In fact, changing this to

$settings = $this->configFactory->get('system.site');

Still an empty data[] array in the object.

Still debugging, and setting up a microsite through the browser, the same bit of code loads the config objects properly.

@millnut is there something missing when we're running these kernel tests? Some dependency?

All the failing tests are kernel tests.

millnut commented 22 hours ago

Not sure I don't have time this week to look into in much detail (on holiday 😄 ) but downgrading to group 3.2.2 does make the tests pass.

Downgrading drupal/flexible_permissions (2.0.1 => 1.1.0)
Downgrading drupal/group (3.3.0 => 3.2.2)
PHPUnit 9.6.21 by Sebastian Bergmann and contributors.

Testing Drupal\Tests\localgov_microsites_group\Kernel\GroupDefaultContentTest
Group Default Content (Drupal\Tests\localgov_microsites_group\Kernel\GroupDefaultContent)
 ✔ Generate

Time: 00:31.793, Memory: 10.00 MB

OK (1 test, 24 assertions)