- Issue created by @spokje
- Merge request !9676Draft: Run repeat-class-test as 1500x LayoutBuilderBlocksTest::testBlockPlaceholder → (Open) created by spokje
- 🇳🇱Netherlands spokje
So MR!9676 (https://git.drupalcode.org/issue/drupal-3477586/-/jobs/2891429) shows that this test fails ~26/1500 runs.
- 🇳🇱Netherlands spokje
At first glance, I can think of two ways the placeholder is not replaced:
- Setting the
$block_content
in\Drupal::state()
goes wrong/causes a race condition - The "magic" in
\Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray::onBuildRender
does something unexpected and we end up in theif ($is_content_empty && $is_placeholder_ready)
where we set the placeholder again, with similar content as the original one.
Let's assert both.
- Setting the
- 🇳🇱Netherlands spokje
So looking at all the test failures being:
Drupal\Tests\layout_builder\Functional\LayoutBuilderBlocksTest::testBlockPlaceholder Behat\Mink\Exception\ResponseTextException: The text "is_content_empty && is_placeholder_ready Placeholder for the "The block label" block" appears in the text of this page, but it should not.
I think we can safely say it's #2.
- 🇳🇱Netherlands spokje
$content = $block->build()
in\Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray::onBuildRender
ends up in\Drupal\layout_builder\Plugin\Block\ExtraFieldBlock::build
.The only way I can see that returning empty would be if we land in this if-branch:
if (!isset($extra_fields['display'][$this->fieldName]))
.Which in turn would mean
\Drupal\Core\Entity\EntityFieldManager::getExtraFields
would return an array without$extra_fields['display'][$this->fieldName]
, which would mean in\Drupal\Core\Entity\EntityFieldManager::getExtraFields
,$this->extraFields[$entity_type_id][$bundle]
would not be set. - 🇳🇱Netherlands spokje
This is where it ends for me, I really have no idea what's happening to cause the random failure.