You are here

public function MigrateBlockContentBodyFieldTest::testBlockContentBodyFieldMigration in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentBodyFieldTest.php \Drupal\Tests\block_content\Kernel\Migrate\MigrateBlockContentBodyFieldTest::testBlockContentBodyFieldMigration()
  2. 10 core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentBodyFieldTest.php \Drupal\Tests\block_content\Kernel\Migrate\MigrateBlockContentBodyFieldTest::testBlockContentBodyFieldMigration()

Tests the block content body field migration.

File

core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentBodyFieldTest.php, line 36

Class

MigrateBlockContentBodyFieldTest
Attaches a body field to the custom block type.

Namespace

Drupal\Tests\block_content\Kernel\Migrate

Code

public function testBlockContentBodyFieldMigration() {

  /** @var \Drupal\field\FieldStorageConfigInterface $storage */
  $storage = FieldStorageConfig::load('block_content.body');
  $this
    ->assertInstanceOf(FieldStorageConfigInterface::class, $storage);
  $this
    ->assertIdentical('block_content', $storage
    ->getTargetEntityTypeId());
  $this
    ->assertIdentical([
    'basic',
  ], array_values($storage
    ->getBundles()));
  $this
    ->assertIdentical('body', $storage
    ->getName());

  /** @var \Drupal\field\FieldConfigInterface $field */
  $field = FieldConfig::load('block_content.basic.body');
  $this
    ->assertInstanceOf(FieldConfigInterface::class, $field);
  $this
    ->assertIdentical('block_content', $field
    ->getTargetEntityTypeId());
  $this
    ->assertIdentical('basic', $field
    ->getTargetBundle());
  $this
    ->assertIdentical('body', $field
    ->getName());
  $this
    ->assertIdentical('Body', $field
    ->getLabel());
}