LayoutBuilderEntityViewDisplayTest.php in Drupal 9
File
core/modules/layout_builder/tests/src/Functional/Jsonapi/LayoutBuilderEntityViewDisplayTest.php
View source
<?php
namespace Drupal\Tests\layout_builder\Functional\Jsonapi;
use Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage;
use Drupal\Tests\jsonapi\Functional\EntityViewDisplayTest;
class LayoutBuilderEntityViewDisplayTest extends EntityViewDisplayTest {
protected static $modules = [
'layout_builder',
];
protected $defaultTheme = 'stark';
protected function createEntity() {
$entity = parent::createEntity();
$entity
->enableLayoutBuilder()
->setOverridable()
->save();
$this
->assertCount(1, $entity
->getThirdPartySetting('layout_builder', 'sections'));
return $entity;
}
protected function getExpectedDocument() {
$document = parent::getExpectedDocument();
array_unshift($document['data']['attributes']['dependencies']['module'], 'layout_builder');
$document['data']['attributes']['hidden'][OverridesSectionStorage::FIELD_NAME] = TRUE;
$document['data']['attributes']['third_party_settings']['layout_builder'] = [
'enabled' => TRUE,
'allow_custom' => TRUE,
];
return $document;
}
}