Updated to Drupal 8.6.4, which is PHP 7.3 friendly. Also updated HTMLaw library....
[yaffs-website] / web / core / modules / layout_builder / tests / src / Kernel / LayoutSectionItemListTest.php
1 <?php
2
3 namespace Drupal\Tests\layout_builder\Kernel;
4
5 use Drupal\entity_test\Entity\EntityTestBaseFieldDisplay;
6 use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay;
7
8 /**
9  * Tests the field type for Layout Sections.
10  *
11  * @coversDefaultClass \Drupal\layout_builder\Field\LayoutSectionItemList
12  *
13  * @group layout_builder
14  */
15 class LayoutSectionItemListTest extends SectionStorageTestBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   public static $modules = [
21     'field',
22     'text',
23   ];
24
25   /**
26    * {@inheritdoc}
27    */
28   protected function getSectionStorage(array $section_data) {
29     $this->installEntitySchema('entity_test_base_field_display');
30     LayoutBuilderEntityViewDisplay::create([
31       'targetEntityType' => 'entity_test_base_field_display',
32       'bundle' => 'entity_test_base_field_display',
33       'mode' => 'default',
34       'status' => TRUE,
35     ])
36       ->enableLayoutBuilder()
37       ->setOverridable()
38       ->save();
39
40     array_map(function ($row) {
41       return ['section' => $row];
42     }, $section_data);
43     $entity = EntityTestBaseFieldDisplay::create([
44       'name' => 'The test entity',
45       'layout_builder__layout' => $section_data,
46     ]);
47     $entity->save();
48     return $entity->get('layout_builder__layout');
49   }
50
51 }