Problem/Motivation

Branch tests for 3.1.x-dev are broken at HEAD:

$ ../vendor/phpunit/phpunit/phpunit -c core/ modules/contrib/permissions_by_term/ --verbose
PHPUnit 8.5.15 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.25-1+0~20201130.73+debian10~1.gbp042074
Configuration: /var/www/html/web/core/phpunit.xml.dist

Testing modules/contrib/permissions_by_term/
......................F......                                     29 / 29 (100%)

Time: 4.06 minutes, Memory: 6.00 MB

There was 1 failure:

1) Drupal\Tests\permissions_by_term\Kernel\NodeEntityBundleInfoTest::testGetPermissionsByTids
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     'roleLabels' => Array (
         1 => Array (
-            0 => 'First Role'
+            0 => 'administrator'
+            1 => 'First Role'
+            2 => 'Second Role'
+            3 => 'Third Role'
+        )
+        2 => Array (
+            0 => 'administrator'
             1 => 'Second Role'
             2 => 'Third Role'
-            3 => 'administrator'
-        )
-        2 => Array (
-            0 => 'Second Role'
-            1 => 'Third Role'
-            2 => 'administrator'
         )
     )
     'userDisplayNames' => Array (...)
 )

/var/www/html/vendor/phpunit/phpunit/src/Framework/Constraint/IsEqual.php:100
/var/www/html/vendor/phpunit/phpunit/src/Framework/Assert.php:2924
/var/www/html/vendor/phpunit/phpunit/src/Framework/Assert.php:629
/var/www/html/web/modules/contrib/permissions_by_term/tests/src/Kernel/NodeEntityBundleInfoTest.php:102
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:703

FAILURES!
Tests: 29, Assertions: 404, Failures: 1.

Remaining self deprecation notices (72)

  29x: Installing the tables key_value and key_value_expire with the method KernelTestBase::installSchema() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. The tables are now lazy loaded and therefore will be installed automatically when used. See https://www.drupal.org/node/3143286
    1x in EntityAccessCheckTest::testBaseAccessControl from Drupal\Tests\permissions_by_entity\Kernel
    1x in AccessStorageTest::testSaveMultipleLanguageCodes from Drupal\Tests\permissions_by_term\Kernel
    1x in PermissionModeTest::testNodeAccessRecordCreation from Drupal\Tests\permissions_by_term\Kernel
    1x in PermissionModeTest::testHandleNodeAsAdmin from Drupal\Tests\permissions_by_term\Kernel
    1x in PermissionModeTest::testHandleNode from Drupal\Tests\permissions_by_term\Kernel
    1x in PermissionModeTest::testCanAdminUserAccessByNodeId from Drupal\Tests\permissions_by_term\Kernel
    1x in PermissionModeTest::testCanUserAccessByNodeId from Drupal\Tests\permissions_by_term\Kernel
    1x in NodeEntityBundleInfoTest::testGetPermissionsByTids from Drupal\Tests\permissions_by_term\Kernel
    1x in NodeAccessRecordsTest::testCreateIfTermHasNoPermissionButPermissionModeIsOn from Drupal\Tests\permissions_by_term\Kernel
    1x in NodeAccessRecordsTest::testCreateIfTermHasPermission from Drupal\Tests\permissions_by_term\Kernel
    1x in NodeAccessRecordsTest::testCreateNone from Drupal\Tests\permissions_by_term\Kernel
    1x in MultilingualTest::testCanNotAccess from Drupal\Tests\permissions_by_term\Kernel
    1x in MultilingualTest::testCanAccess from Drupal\Tests\permissions_by_term\Kernel
    1x in AccessStorageTest::testTidsByNidRetrieval from Drupal\Tests\permissions_by_term\Kernel
    1x in AccessCheckTest::testIsAnyTaxonomyTermFieldDefinedInNodeType from Drupal\Tests\permissions_by_term\Kernel
    1x in EntityAccessCheckTest::testAnonymousAccessDeniedUsingKernel from Drupal\Tests\permissions_by_entity\Kernel
    1x in AccessCheckTest::testBypassNodeAccess from Drupal\Tests\permissions_by_term\Kernel
    1x in AccessCheckTest::testCheckAccessAsGuestWithTermRestriction from Drupal\Tests\permissions_by_term\Kernel
    1x in AccessCheckTest::testCheckAccessAsGuestWithNoTermRestriction from Drupal\Tests\permissions_by_term\Kernel
    1x in AccessCheckTest::testRequireAllTermsGrantedWithNoRestrictedTerms from Drupal\Tests\permissions_by_term\Kernel
    1x in AccessCheckTest::testRequireAllTermsGrantedWithRestrictedTerms from Drupal\Tests\permissions_by_term\Kernel
    1x in AccessCheckTest::testNoTermRestriction from Drupal\Tests\permissions_by_term\Kernel
    1x in AccessCheckTest::testNoGrantedTermRestriction from Drupal\Tests\permissions_by_term\Kernel
    1x in AccessCheckTest::testDisabledRequireAllTermsGranted from Drupal\Tests\permissions_by_term\Kernel
    1x in EntityPublicationTest::testAnonymousCannotViewUnpublishedNodesWithoutTermPermissions from Drupal\Tests\permissions_by_entity\Kernel
    1x in EntityPublicationTest::testAnonymousCanViewPublishedNodesWithoutTermPermissions from Drupal\Tests\permissions_by_entity\Kernel
    1x in EntityAccessCheckTest::testAuthenticatedDeniedOnCachedAccessUsingKernel from Drupal\Tests\permissions_by_entity\Kernel
    1x in EntityAccessCheckTest::testAuthenticatedAccessUsingKernel from Drupal\Tests\permissions_by_entity\Kernel
    1x in TermHandlerTest::testGetTidsBoundForAllNids from Drupal\Tests\permissions_by_term\Kernel

  9x: The Drupal\Tests\permissions_by_term\Kernel\AccessCheckTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    9x in DrupalListener::startTest from Drupal\Tests\Listeners

  5x: The Drupal\Tests\permissions_by_term\Kernel\PermissionModeTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    5x in DrupalListener::startTest from Drupal\Tests\Listeners

  4x: Declaring ::setUp without a void return typehint in Drupal\Tests\permissions_by_entity\Kernel\EntityAccessCheckTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    4x in DrupalListener::startTest from Drupal\Tests\Listeners

  4x: The Drupal\Tests\permissions_by_entity\Kernel\EntityAccessCheckTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    4x in DrupalListener::startTest from Drupal\Tests\Listeners

  3x: The Drupal\Tests\permissions_by_term\Kernel\NodeAccessRecordsTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    3x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: The Drupal\Tests\permissions_by_term\Kernel\MultilingualTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: Declaring ::setUp without a void return typehint in Drupal\Tests\permissions_by_term\Kernel\MultilingualTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: The Drupal\Tests\permissions_by_term\Kernel\AccessStorageTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: Declaring ::setUp without a void return typehint in Drupal\Tests\permissions_by_term\Kernel\AccessStorageTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: The Drupal\Tests\permissions_by_entity\Kernel\EntityPublicationTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: Declaring ::setUp without a void return typehint in Drupal\Tests\permissions_by_entity\Kernel\EntityPublicationTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: AssertLegacyTrait::assertNotEqual() is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use $this->assertNotEquals() instead. See https://www.drupal.org/node/3129738
    1x in EntityPublicationTest::testAnonymousCanViewPublishedNodesWithoutTermPermissions from Drupal\Tests\permissions_by_entity\Kernel

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\permissions_by_term\Kernel\NodeEntityBundleInfoTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: The Drupal\Tests\permissions_by_term\Kernel\NodeEntityBundleInfoTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Calling the Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch() method with a string event name as the first argument is deprecated in drupal:9.1.0, an Event object will be required instead in drupal:10.0.0. See https://www.drupal.org/node/3154407
    1x in PermissionModeTest::testHandleNode from Drupal\Tests\permissions_by_term\Kernel

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\permissions_by_term\Kernel\TermHandlerTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: The Drupal\Tests\permissions_by_term\Kernel\TermHandlerTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

Remaining direct deprecation notices (5)

  5x: Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.
    3x in EntityAccessCheckTest::testAuthenticatedDeniedOnCachedAccessUsingKernel from Drupal\Tests\permissions_by_entity\Kernel
    1x in EntityAccessCheckTest::testAnonymousAccessDeniedUsingKernel from Drupal\Tests\permissions_by_entity\Kernel
    1x in EntityAccessCheckTest::testAuthenticatedAccessUsingKernel from Drupal\Tests\permissions_by_entity\Kernel

Setting to urgent per Issue Priority field

Cause tests to fail in HEAD on the automated testing platform for any supported environment (including random failures), since this blocks all other work.

There are also 70+ deprecation notices, but those can be handled in a follow-up issue once this development blocker has been removed.

Steps to reproduce

Run tests locally

Proposed resolution

Fix failing test

Remaining tasks

Debug and submit patch

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Chris Burge created an issue. See original summary.

chris burge’s picture

This bug also exists in 8.x-2.x. The fix should be backported.

chris burge’s picture

Status: Active » Needs review
StatusFileSize
new793 bytes

Patch attached. Test results below:

b$ ../vendor/phpunit/phpunit/phpunit -c core/ modules/contrib/permissions_by_term/tests/src/Kernel/NodeEntityBundleInfoTest.php --verbose
PHPUnit 8.5.15 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.25-1+0~20201130.73+debian10~1.gbp042074
Configuration: /var/www/html/web/core/phpunit.xml.dist

Testing Drupal\Tests\permissions_by_term\Kernel\NodeEntityBundleInfoTest
.                                                                   1 / 1 (100%)

Time: 40.4 seconds, Memory: 4.00 MB

OK (1 test, 14 assertions)

Remaining self deprecation notices (3)

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\permissions_by_term\Kernel\NodeEntityBundleInfoTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: The Drupal\Tests\permissions_by_term\Kernel\NodeEntityBundleInfoTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Installing the tables key_value and key_value_expire with the method KernelTestBase::installSchema() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. The tables are now lazy loaded and therefore will be installed automatically when used. See https://www.drupal.org/node/3143286
    1x in NodeEntityBundleInfoTest::testGetPermissionsByTids from Drupal\Tests\permissions_by_term\Kernel

paulocs’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new10.03 KB

Patch fixes error in test.
I will trigger the tests and add screenshot after I ran tests locally.
Thanks Chris

jepster_’s picture

This issue is tied to PHPUnit 8.x. In PHPUnit 7.5.20 the tests do pass: https://bitbucket.org/publicplan/permissions_by_term/addon/pipelines/hom...

jepster_’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

Thanks for the patch. Could you try to create a merge request via GitLab, please?

paulocs’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

marcoliver made their first commit to this issue’s fork.

marcoliver’s picture

I've updated the issue fork against the current dev state and fixed some more broken tests for phpunit 8 and 9.

  • marcoliver committed 2335a734 on 3.1.x-dev authored by paulocs
    Issue #3217414 by paulocs, Chris Burge, marcoliver, Peter Majmesku: 3.1....
marcoliver’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in 3.1.24, thanks everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.