Updated to Drupal 8.6.4, which is PHP 7.3 friendly. Also updated HTMLaw library....
[yaffs-website] / web / core / modules / block_content / tests / src / Kernel / Migrate / MigrateBlockContentBodyFieldTest.php
1 <?php
2
3 namespace Drupal\Tests\block_content\Kernel\Migrate;
4
5 use Drupal\field\Entity\FieldConfig;
6 use Drupal\field\Entity\FieldStorageConfig;
7 use Drupal\field\FieldConfigInterface;
8 use Drupal\field\FieldStorageConfigInterface;
9 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
10
11 /**
12  * Attaches a body field to the custom block type.
13  *
14  * @group block_content
15  */
16 class MigrateBlockContentBodyFieldTest extends MigrateDrupal7TestBase {
17
18   public static $modules = ['block', 'block_content', 'filter', 'text'];
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function setUp() {
24     parent::setUp();
25     $this->installConfig(['block_content']);
26     $this->installEntitySchema('block_content');
27     $this->executeMigrations([
28       'block_content_type',
29       'block_content_body_field',
30     ]);
31   }
32
33   /**
34    * Tests the block content body field migration.
35    */
36   public function testBlockContentBodyFieldMigration() {
37     /** @var \Drupal\field\FieldStorageConfigInterface $storage */
38     $storage = FieldStorageConfig::load('block_content.body');
39     $this->assertTrue($storage instanceof FieldStorageConfigInterface);
40     $this->assertIdentical('block_content', $storage->getTargetEntityTypeId());
41     $this->assertIdentical(['basic'], array_values($storage->getBundles()));
42     $this->assertIdentical('body', $storage->getName());
43
44     /** @var \Drupal\field\FieldConfigInterface $field */
45     $field = FieldConfig::load('block_content.basic.body');
46     $this->assertTrue($field instanceof FieldConfigInterface);
47     $this->assertIdentical('block_content', $field->getTargetEntityTypeId());
48     $this->assertIdentical('basic', $field->getTargetBundle());
49     $this->assertIdentical('body', $field->getName());
50     $this->assertIdentical('Body', $field->getLabel());
51   }
52
53 }