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->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->formElement() (Line: 464)
Drupal\Core\Field\WidgetBase->formSingleElement() (Line: 101)
Drupal\Core\Field\WidgetBase->form() (Line: 197)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm() (Line: 121)
Drupal\Core\Entity\ContentEntityForm->form() (Line: 138)
Drupal\node\Form\NodeForm->form() (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm()
call_user_func_array() (Line: 528)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 279)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 622)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 36)
Drupal\Core\Test\StackMiddleware\TestWaitTerminateMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 715)
Drupal\Core\DrupalKernel->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.
Comments
Comment #5
jcandan commentedComment #7
jcandan commentedGiven the jump in assertions, I consider this a success.