LayoutBuilderEntityViewDisplayTest.php

Same filename in this branch
  1. 9 core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php
Same filename in other branches
  1. 8.9.x core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php
  2. 8.9.x core/modules/layout_builder/tests/src/Functional/Jsonapi/LayoutBuilderEntityViewDisplayTest.php
  3. 10 core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php
  4. 10 core/modules/layout_builder/tests/src/Functional/Jsonapi/LayoutBuilderEntityViewDisplayTest.php
  5. 11.x core/modules/layout_builder/tests/src/Kernel/LayoutBuilderEntityViewDisplayTest.php
  6. 11.x core/modules/layout_builder/tests/src/Functional/Jsonapi/LayoutBuilderEntityViewDisplayTest.php

Namespace

Drupal\Tests\layout_builder\Functional\Jsonapi

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;

/**
 * JSON:API integration test for the "EntityViewDisplay" config entity type.
 *
 * @group jsonapi
 * @group layout_builder
 */
class LayoutBuilderEntityViewDisplayTest extends EntityViewDisplayTest {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'layout_builder',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    protected function createEntity() {
        
        /** @var \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay $entity */
        $entity = parent::createEntity();
        $entity->enableLayoutBuilder()
            ->setOverridable()
            ->save();
        $this->assertCount(1, $entity->getThirdPartySetting('layout_builder', 'sections'));
        return $entity;
    }
    
    /**
     * {@inheritdoc}
     */
    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;
    }

}

Classes

Title Deprecated Summary
LayoutBuilderEntityViewDisplayTest JSON:API integration test for the "EntityViewDisplay" config entity type.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.