function MigrateBlockContentBodyFieldTest::testBlockContentBodyFieldMigration

Same name in other branches
  1. 9 core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentBodyFieldTest.php \Drupal\Tests\block_content\Kernel\Migrate\MigrateBlockContentBodyFieldTest::testBlockContentBodyFieldMigration()
  2. 8.9.x core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentBodyFieldTest.php \Drupal\Tests\block_content\Kernel\Migrate\MigrateBlockContentBodyFieldTest::testBlockContentBodyFieldMigration()
  3. 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 41

Class

MigrateBlockContentBodyFieldTest
Attaches a body field to the block type.

Namespace

Drupal\Tests\block_content\Kernel\Migrate

Code

public function testBlockContentBodyFieldMigration() : void {
    
    /** @var \Drupal\field\FieldStorageConfigInterface $storage */
    $storage = FieldStorageConfig::load('block_content.body');
    $this->assertInstanceOf(FieldStorageConfigInterface::class, $storage);
    $this->assertSame('block_content', $storage->getTargetEntityTypeId());
    $this->assertSame([
        'basic',
    ], array_values($storage->getBundles()));
    $this->assertSame('body', $storage->getName());
    
    /** @var \Drupal\field\FieldConfigInterface $field */
    $field = FieldConfig::load('block_content.basic.body');
    $this->assertInstanceOf(FieldConfigInterface::class, $field);
    $this->assertSame('block_content', $field->getTargetEntityTypeId());
    $this->assertSame('basic', $field->getTargetBundle());
    $this->assertSame('body', $field->getName());
    $this->assertSame('Body', $field->getLabel());
}

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