Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining test failures #396

Open
stephen-cox opened this issue Mar 30, 2023 · 7 comments
Open

Remaining test failures #396

stephen-cox opened this issue Mar 30, 2023 · 7 comments

Comments

@stephen-cox
Copy link
Member

Now we've resolved a bunch of issues that were causing tests to fail (#376, #390, #393), it's exposed some further test failures:

$ phpunit web/modules/contrib/localgov_microsites_group/
PHPUnit 9.6.6 by Sebastian Bergmann and contributors.

Testing /app/web/modules/contrib/localgov_microsites_group
.......EE...........FF....                                        26 / 26 (100%)

Time: 28:00.907, Memory: 16.00 MB

There were 2 errors:

1) Drupal\Tests\localgov_microsites_group_term_ui\Functional\ManageGroupTermsTest::testGroupTermUi
Behat\Mink\Exception\ElementNotFoundException: Button with id|name|label|value "Save and go to list" not found.

/app/web/core/tests/Drupal/Tests/WebAssert.php:148
/app/web/core/tests/Drupal/Tests/UiHelperTrait.php:77
/app/web/modules/contrib/localgov_microsites_group/modules/localgov_microsites_group_term_ui/tests/src/Functional/ManageGroupTermsTest.php:86
/app/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

2) Drupal\Tests\localgov_microsites_group_term_ui\Functional\ManageGroupTermsTest::testGroupTermPermissions
Behat\Mink\Exception\ExpectationException: Current response status code is 500, but 403 expected.

/app/vendor/behat/mink/src/WebAssert.php:794
/app/vendor/behat/mink/src/WebAssert.php:130
/app/web/core/tests/Drupal/Tests/WebAssert.php:818
/app/web/modules/contrib/localgov_microsites_group/modules/localgov_microsites_group_term_ui/tests/src/Functional/ManageGroupTermsTest.php:124
/app/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

--

There were 2 failures:

1) Drupal\Tests\localgov_microsites_group\Kernel\GroupPermissionsHelperTest::testGetPermissions
Failed asserting that true is false.

/app/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:122
/app/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55
/app/web/modules/contrib/localgov_microsites_group/tests/src/Kernel/GroupPermissionsHelperTest.php:141
/app/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

2) Drupal\Tests\localgov_microsites_group\Kernel\GroupPermissionsHelperTest::testToggleModulePermissions
Failed asserting that true is false.

/app/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:122
/app/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55
/app/web/modules/contrib/localgov_microsites_group/tests/src/Kernel/GroupPermissionsHelperTest.php:154
/app/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
@stephen-cox
Copy link
Member Author

There are 4 failures here.

1. ElementNotFoundException: Button with id|name|label|value "Save and go to list" not found.

Should be fixed with f96601b

2. Drupal\Tests\localgov_microsites_group_term_ui\Functional\ManageGroupTermsTest::testGroupTermPermissions: Current response status code is 500, but 403 expected.

I'm not sure what's going wrong here. An error is being thrown when checking permissions. I don't think anything we've done has changed this so wondering if it's a bug in the flexible_permissions module.

<em>Drupal\flexible_permissions\CalculatedPermissionsScopeException</em>: The calculator "Drupal\group\Access\IndividualGroupPermissionCalculator" returned permissions for scopes other than "individual". in <em class="placeholder">Drupal\flexible_permissions\ChainPermissionCalculator-&gt;calculatePermissions()</em> (line <em class="placeholder">145</em> of <em class="placeholder">modules/contrib/flexible_permissions/src/ChainPermissionCalculator.php</em>). </p><pre class="backtrace">Drupal\group\Access\GroupPermissionCalculator-&gt;calculateFullPermissions(Object) (Line: 46)
Drupal\group\Access\GroupPermissionChecker-&gt;hasPermissionInGroup('manage taxonomy terms', Object, Object) (Line: 213)
Drupal\group\Entity\Group-&gt;hasPermission('manage taxonomy terms', Object) (Line: 184)
Drupal\localgov_microsites_group_term_ui\Controller\GroupTermUiController-&gt;listTaxonomiesAccess(Object, Object)
...

3. Drupal\Tests\localgov_microsites_group\Kernel\GroupPermissionsHelperTest::testGetPermissions:141 Failed asserting that true is false.

This fails at https://github.com/localgovdrupal/localgov_microsites_group/blob/2.x/tests/src/Kernel/GroupPermissionsHelperTest.php#L141

I've confirmed that the permissions entity has the correct permissions, so there's an issue updating the group entity permissions from the permissions entity. I suspect the cache flush before this check is not causing group permissions to be reloaded.

4. Drupal\Tests\localgov_microsites_group\Kernel\GroupPermissionsHelperTest::testToggleModulePermissions
Failed asserting that true is false.

This fails at https://github.com/localgovdrupal/localgov_microsites_group/blob/2.x/tests/src/Kernel/GroupPermissionsHelperTest.php#L154

This is similar to 3. I think the cache flush is not doing what we would like.

@millnut
Copy link
Member

millnut commented Sep 17, 2023

@stephen-cox I've got a green test for Drupal\Tests\localgov_microsites_group_term_ui\Functional\ManageGroupTermsTest::testGroupTermPermissions now, just looking at the others

@finnlewis
Copy link
Member

@stephen-cox and @millnut are working on these test failures above. If anyone is diving in to help, check in with @stephen-cox and @millnut to avoid duplication.

Note: we think 3. and 4. above are generated from group_permissions

https://www.drupal.org/project/group_permissions

This patch fixes the EntityAccess issue https://www.drupal.org/project/group_permissions/issues/3368882

@stephen-cox
Copy link
Member Author

@millnut Was good to chat with you yesterday - I've taken another look at the tests failures in the localgov_microsites_group_term_ui module after our discussion and have a fix for these here #425.

For reference the issue on d.o. for the other 2 failing tests is here: https://www.drupal.org/project/group_permissions/issues/3388880

@finnlewis
Copy link
Member

Just discussing in tech drop-in.

This is the test that is failing:
https://github.com/localgovdrupal/localgov_microsites_group/blob/2.x/tests/src/Kernel/GroupPermissionsHelperTest.php#L141

Can anyone re-write this test to test in a different way? @ekes was wondering if maybe a functional browser test to do the same thing might be appropriate?

@finnlewis
Copy link
Member

CC @ekes

@ekes
Copy link
Member

ekes commented Oct 19, 2023

https://www.drupal.org/project/group_permissions/issues/3395306

The test certainly confirms the cache clear issue, but also if I'm correct shows removal of permissions failing again.

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

No branches or pull requests

4 participants