Problem/Motivation
When I pushed the branch for node/3582330, phpunit reported,
There was 1 failure:
1) Drupal\Tests\auto_entitylabel\Kernel\AutoEntityLabelPermissionControllerTest::testAutoEntityLabelPermissions
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
'administer node_type labels' => [...]
+ 'administer entity_test_no_id_bundle labels' => [...]
)
/builds/issue/auto_entitylabel-3582330/tests/src/Kernel/AutoEntityLabelPermissionControllerTest.php:70
FAILURES!
this is unrelated to that ticket, so I opened a new one.
Steps to reproduce
see https://git.drupalcode.org/issue/auto_entitylabel-3582330/-/jobs/9160899
Proposed resolution
Rather than asserting that the whole array is identical, check the individual array values that we care about.
Remaining tasks
rewrite the test and make an MR
Issue fork auto_entitylabel-3582451
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
Comment #3
benstallings commentedComment #4
csakiistvanEnvironment
Prerequisites
SIMPLETEST_DBpointing at the database).Root cause
The test extends
EntityKernelTestBase, which enables theentity_testmodule. On current Drupal core,entity_testdefines an extra bundle entity type (entity_test_no_id_bundle), soautoEntityLabelPermissions()returns an additionaladminister entity_test_no_id_bundle labelspermission. The test asserted the entire permissions array equalled only thenode_typeentry, so the extra key made the assertion fail.Steps
administer node_type labelsentry, instead of asserting the whole array is identical.ddev drush crddev exec "SIMPLETEST_DB=mysql://db:db@db/db vendor/bin/phpunit -c web/core web/modules/contrib/auto_entitylabel/tests/src/Kernel/AutoEntityLabelPermissionControllerTest.php"Expected results
administer node_type labelspermission is still asserted to have the correct title and access settings.Actual results
Before the fix, the test failed: the actual permissions array contained an extra
administer entity_test_no_id_bundle labelskey that the strict whole-arrayassertEqualsdid not expect. After applying the fix, the test passes (16 assertions, 0 failures), asserting only the presence and content of theadminister node_type labelsentry. The single remaining deprecation notice about#[RunTestsInSeparateProcesses]is unrelated core behaviour affecting all kernel tests.Testing produced with the assistance of an LLM.
Comment #5
csakiistvan