a554fb526f93582976755b47438e1c5714bdeb7a
[yaffs-website] / web / core / modules / layout_builder / tests / src / Kernel / LayoutBuilderEntityViewDisplayTest.php
1 <?php
2
3 namespace Drupal\Tests\layout_builder\Kernel;
4
5 use Drupal\Core\Config\Schema\SchemaIncompleteException;
6 use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay;
7
8 /**
9  * @coversDefaultClass \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay
10  *
11  * @group layout_builder
12  */
13 class LayoutBuilderEntityViewDisplayTest extends SectionStorageTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   protected function getSectionStorage(array $section_data) {
19     $display = LayoutBuilderEntityViewDisplay::create([
20       'targetEntityType' => 'entity_test',
21       'bundle' => 'entity_test',
22       'mode' => 'default',
23       'status' => TRUE,
24       'third_party_settings' => [
25         'layout_builder' => [
26           'sections' => $section_data,
27         ],
28       ],
29     ]);
30     $display->save();
31     return $display;
32   }
33
34   /**
35    * Tests that configuration schema enforces valid values.
36    */
37   public function testInvalidConfiguration() {
38     $this->setExpectedException(SchemaIncompleteException::class);
39     $this->sectionStorage->getSection(0)->getComponent('first-uuid')->setConfiguration(['id' => 'foo', 'bar' => 'baz']);
40     $this->sectionStorage->save();
41   }
42
43 }