Fix head tests or fix related functionality if necessary

Created on 23 April 2025, 4 months ago

Problem/Motivation

A 2.0.x branch has been created, there's known test failures that will need some time to figure out.

Steps to reproduce

Run the pipeline and see the errors.

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

N/A

πŸ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada joseph.olstad

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @joseph.olstad
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Possible lead to a fix.

    Steps to reproduce:

    1. Fresh install of Drupal 10.4.6
    2. Set french as original language (site default language)
    3. Add english as a second language option
    4. configure language negotiation using a two letter prefix
    5. install layout_builder_st
    6. configure a bundle like article or basic page to have translation enabled
    7. create a node, then try to edit the layout on one node in english (the second language)

    Exception occurs

    - edit the layout on the same node using french (the original/site default language), no error , able to edit the layout without exception.

    see screenshot:
    β†’

    exception message follows: (from core)

    The website encountered an unexpected error. Try again later.
    
    TypeError: Drupal\Component\Utility\UrlHelper::buildQuery(): Argument #1 ($query) must be of type array, null given, called in /docroot/html/core/modules/contextual/contextual.module on line 178 in Drupal\Component\Utility\UrlHelper::buildQuery() (line 42 of core/lib/Drupal/Component/Utility/UrlHelper.php).
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    My guess is, something in core changed between Drupal 9.5 through to Drupal 10.4 / Drupal 11.1 causing this exception to be thrown.

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    liam morland β†’ made their first commit to this issue’s fork.

  • Merge request !30Resolve #3520741 "Fix head tests" β†’ (Merged) created by heddn
  • Pipeline finished with Failed
    about 1 month ago
    #550554
  • First commit to issue fork.
  • Pipeline finished with Failed
    about 1 month ago
    #550578
  • heddn Nicaragua

    The easy fix was to pull in πŸ› Contextual links for translation are removed by core Active . However, I'm fully convinced that one of

    are being faced. In TranslateBlockForm::createTranslationElement, we interact with TypedData and that triggers validations of TypedConfigManager plugins in TypedDataManager. I'm not sure how to solve this. For now posting my findings.

    You too can reproduce this on a 10.4 or later site and this module.

    drush en -y content_translation layout_builder_st field_ui

    1. Add a second language: admin/config/regional/language/add
    2. Enable translations for Content => Basic page content type: admin/config/regional/content-language
    3. Configure view display to use layout builder and have customized displays: admin/structure/types/manage/page/display
    4. Add a node and translate it: node/add/page & node/1/translations
    5. Attempt to edit any of the layout blocks via contextual links on the translation node/1/layout
  • heddn Nicaragua

    If you patch core with the attached test, something between 10.2.0 and 10.3.0 broke. This is the logic that lb_st is trying to do.

    index a7048f38eef..d9438019a39 100644
    --- a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php
    +++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php
    @@ -9,6 +9,7 @@
     use Drupal\Core\TypedData\DataDefinition;
     use Drupal\Core\TypedData\ListDataDefinition;
     use Drupal\Core\TypedData\MapDataDefinition;
    +use Drupal\Core\TypedData\Plugin\DataType\StringData;
     use Drupal\Core\TypedData\Type\BinaryInterface;
     use Drupal\Core\TypedData\Type\BooleanInterface;
     use Drupal\Core\TypedData\Type\DateTimeInterface;
    @@ -697,4 +698,24 @@ public function testTypedDataValidation(): void {
         $this->assertSame('0.value', $violations[0]->getPropertyPath());
       }
     
    +  public function testTypedDataGet(): void {
    +    $this->enableModules([
    +      'layout_builder',
    +      'layout_discovery',
    +      'block',
    +      'contextual'
    +    ]);
    +    $type_definition = $this->container->get('config.typed')
    +      ->getDefinition('block.settings.inline_block:*');
    +    $definition = new $type_definition['definition_class']($type_definition);
    +    $definition->setClass($type_definition['class']);
    +    $typed_data = $type_definition['class']::createInstance($definition);
    +    $typed_data->setValue([
    +      'id' => 'inline_block:basic',
    +      'label' => 'Test Title',
    +    ]);
    +    $label_data = $typed_data->get('label');
    +    $this->assertInstanceOf(StringData::class, $label_data);
    +  }
    +
     }
    
  • heddn Nicaragua

    The trick seems to be adding $definition->setTypedDataManager($this->typedConfigManager); in the form class. Manually testing and executing tests locally, things are now passing green again. Oh, I also had to fix some of the tests.

    However, πŸ› Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay class does not correspond to an entity type. Needs work is biting us from upstream so tests are again not passing green on the testbot.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Hmm, ok strange so you've fixed the Drupal 10.4.x testing somehow.

    However Drupal 11 testing results is curiously vastly different. Perhaps since it's testing against 11.x-dev instead of 11.1.8 or 11.2.2?

    If we're testing off of 11.x there is a higher chance of seeing turbulence when compared to say testing against 11.1.8 or 11.2.2.

    The Drupal 11 pipelines show 14 failures in the most recent run.

    Not sure if this is of any help however we have been successfully using layout_builder_st dev-2.0.x 68f690c8fb with Drupal 11.1.8 extensively with this concoction of patches:

                        "drupal/layout_builder_st": {
                            "3411037 - Fix core removing contextual translation links": "https://git.drupalcode.org/project/layout_builder_st/-/merge_requests/5.patch",
                            "3420063 - Call to a member function getConfig() OverridesSectionStorage.php": "https://git.drupalcode.org/project/layout_builder_st/-/merge_requests/6.diff",
                            "3069964 - Null fix for moderation dashboard, otherwise WSOD on login": "https://www.drupal.org/files/issues/2025-01-02/3069964-null-fix.patch"
                        },

    Others outside of my groups have builds with layout_builder_st dev-2.0.x with a variety of patches applied and using Drupal 11.1+

    Wondering why Drupal 11..x-dev testing would suddenly show 14 pipeline failures. Previously there were 3 with 22 skips, maybe because now there's only 21 skipped? Maybe the non-skipped test has a lot of failures now that it's no longer skipped?

    Prior to recent changes;
    Tests: 38, Assertions: 1100, Errors: 1, Failures: 3, PHPUnit Deprecations: 1, Skipped: 22.
    https://git.drupalcode.org/project/layout_builder_st/-/jobs/5051465

    Latest pipeline run:

    Tests: 38, Assertions: 98, Errors: 14, PHPUnit Deprecations: 60, Skipped: 21.
    https://git.drupalcode.org/project/layout_builder_st/-/jobs/5051465

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    @heddn, great work, seems like you've pushed things further along!

  • Pipeline finished with Skipped
    27 days ago
    #553166
    • heddn β†’ committed b8d50b83 on 2.0.x
      Issue #3520741 by heddn: Fix head tests or fix related functionality if...
  • heddn Nicaragua

    This goes a long way to improving tests. There are still failing tests, but they are blocked on πŸ› Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay class does not correspond to an entity type. Needs work landing upstream.

  • πŸ‡ΊπŸ‡ΈUnited States millerrs
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Serious chaos has happened with layout_builder_st
    we had @phenaproxima running things, he ended up doing a build of 2.0.x that we have been using successfully with Drupal 11.1.8

    Now I see the latest 2.0.x won't even run testing as it says this:

    8) Drupal\Tests\layout_builder_st\Functional\Rest\LayoutBuilderEntityViewDisplayJsonBasicAuthTest::testGet
    Unable to install modules: module 'layout_builder_st' is incompatible with this version of Drupal core.

    @phenaproxima basically did some heavy modifications from 1x to 2.0.x. It was functional and we have been using it since several months. However there's now been a major reversal on the approach, a new maintainer, did you guys even have a discussion before handoff .

    Here's what we have been using with Drupal 11.1.8

                "name": "drupal/layout_builder_st", 
                "version": "dev-2.0.x",
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/project/layout_builder_st.git",
                    "reference": "68f690c8fb7a679128deaa22bc3d5f0272caec18"
                },
                "require": {
                    "drupal/core": "^10 || ^11"
                },

    with these patches

                        "drupal/layout_builder_st": {
                            "3411037 - Fix core removing contextual translation links": "https://git.drupalcode.org/project/layout_builder_st/-/merge_requests/5.patch", 
                            "3420063 - Call to a member function getConfig() OverridesSectionStorage.php": "https://git.drupalcode.org/project/layout_builder_st/-/merge_requests/6.diff",
                            "3069964 - Null fix for moderation dashboard, otherwise WSOD on login": "https://www.drupal.org/files/issues/2025-01-02/3069964-null-fix.patch"
                        },
    
Production build 0.71.5 2024