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.

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

jcandan created an issue. See original summary.

jcandan’s picture

Assigned: Unassigned » jcandan

  • jcandan committed f38bd632 on 2.0.x
    Issue #3539202: Fix EditPageTest not actually ever hitting assertions
    
jcandan’s picture

Status: Active » Fixed
StatusFileSize
new85.37 KB
new88.81 KB

Given the jump in assertions, I consider this a success.

screenshot of the original count of assertions

screenshot of the jump in count of assertions

Status: Fixed » Closed (fixed)

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