Problem

As of this week, our test started to fail in 3.x with changes on our side. The same pipeline of the same commit was green before.

Broken pipeline: https://git.drupalcode.org/project/custom_elements/-/jobs/6748785

Steps to reproduce

There were 2 failures:
1) Drupal\Tests\custom_elements\Kernel\CustomElementGeneratorTest::testGenerateCoreBothWithLayout
Failed asserting that null is identical to 'This is a test'.
/builds/project/custom_elements/tests/src/Kernel/CustomElementGeneratorTest.php:698
/builds/project/custom_elements/tests/src/Kernel/CustomElementGeneratorTest.php:515
/builds/project/custom_elements/tests/src/Kernel/CustomElementGeneratorTest.php:266
2) Drupal\Tests\custom_elements\Kernel\CustomElementGeneratorTest::testGenerateCoreDefaultWithLayout
Failed asserting that null is identical to 'This is a test'.
/builds/project/custom_elements/tests/src/Kernel/CustomElementGeneratorTest.php:698
/builds/project/custom_elements/tests/src/Kernel/CustomElementGeneratorTest.php:515
/builds/project/custom_elements/tests/src/Kernel/CustomElementGeneratorTest.php:312
FAILURES!
Tests: 67, Assertions: 1585, Failures: 2, PHPUnit Deprecations: 84.
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

fago created an issue. See original summary.

fago’s picture

Found the issue:

Changed Behavior in Drupal 11.x-dev:

Before (Drupal 11.2.5):
- When Layout Builder was enabled on a core entity view display, field components remained in $display->content
- $display->getComponents() returned all configured fields
- custom_elements could copy these components when auto-generating CE displays

After (Drupal 11.x-dev, commit 60bb1a2b7e):
- When Layout Builder is enabled, field components are immediately removed from $display->content and moved to $display->hidden
- $display->getComponents() returns an empty array (since it just returns $this->content)
- custom_elements auto-generation finds no components to copy, resulting in fields being null

This change in behavior is actually acceptable and just a slight change in UX - as long as people have saved their custom-element entity displays. I'd expect that to be the case anyway, but we can document this change in a change-notice to play save. Generally, it could be argued that having an empty list of fields is a good default IF layout builder is used.

TL/DR: I think the status quo with behavior being changed with the core upgrade is fine and we just need to make tests check for that. In th end it's a minor-version update of core and some small changes like this are expected there. There is no change when config is exported properly anyway.

-> Let's use something like https://www.drupal.org/node/3379306

fago’s picture

fago’s picture

Status: Active » Needs work
fago’s picture

Status: Needs work » Needs review

all green again

useernamee’s picture

Looks good. #passed-tr

useernamee’s picture

Status: Needs review » Reviewed & tested by the community

  • useernamee committed 30464536 on 3.x authored by fago
    [#3549949] feat: PHPUnit (next-minor) suddenly fails on CI
    
    By: fago
    By...
useernamee’s picture

Status: Reviewed & tested by the community » Fixed

merged

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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