Fix EditPageTest not actually ever hitting assertions

Created on 31 July 2025, 5 days ago

Problem/Motivation

The EditPageTest is never actually able to run it assert functions.

The following error occurs on the page:

The website encountered an unexpected error. Try again later.<br><br><em
    class="placeholder">Error</em>: Call to undefined method
  Drupal\node\Form\NodeForm::getSectionStorage() in <em
    class="placeholder">Drupal\layout_builder\Plugin\Field\FieldWidget\LayoutBuilderWidget-&gt;getSectionStorage()</em>
  (line <em class="placeholder">60</em> of <em
    class="placeholder">core/modules/layout_builder/src/Plugin/Field/FieldWidget/LayoutBuilderWidget.php</em>).
  <pre class="backtrace">Drupal\layout_builder\Plugin\Field\FieldWidget\LayoutBuilderWidget-&gt;formElement() (Line: 464)
Drupal\Core\Field\WidgetBase-&gt;formSingleElement() (Line: 101)
Drupal\Core\Field\WidgetBase-&gt;form() (Line: 197)
Drupal\Core\Entity\Entity\EntityFormDisplay-&gt;buildForm() (Line: 121)
Drupal\Core\Entity\ContentEntityForm-&gt;form() (Line: 138)
Drupal\node\Form\NodeForm-&gt;form() (Line: 107)
Drupal\Core\Entity\EntityForm-&gt;buildForm()
call_user_func_array() (Line: 528)
Drupal\Core\Form\FormBuilder-&gt;retrieveForm() (Line: 279)
Drupal\Core\Form\FormBuilder-&gt;buildForm() (Line: 73)
Drupal\Core\Controller\FormController-&gt;getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 622)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle() (Line: 36)
Drupal\Core\Test\StackMiddleware\TestWaitTerminateMiddleware-&gt;handle() (Line: 53)
Drupal\Core\StackMiddleware\Session-&gt;handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength-&gt;handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState-&gt;handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel-&gt;handle() (Line: 715)
Drupal\Core\DrupalKernel-&gt;handle() (Line: 19)

So when it checks if ($field->isVisible()) , it never actually proceeds to the $this->assertTrue() test.

Steps to reproduce

Run phpunit with Xdebug and see that the condition is never met because of the error.

Proposed resolution

The easiest fix is to remove Layout Builder from the module list in the test. If this is the solution we go with, we may want to revisit this later.

πŸ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jcandan

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024