class MigrateBlockContentBodyFieldTest
Same name and namespace in other branches
- 11.x core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentBodyFieldTest.php \Drupal\Tests\block_content\Kernel\Migrate\MigrateBlockContentBodyFieldTest
- 10 core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentBodyFieldTest.php \Drupal\Tests\block_content\Kernel\Migrate\MigrateBlockContentBodyFieldTest
- 8.9.x core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentBodyFieldTest.php \Drupal\Tests\block_content\Kernel\Migrate\MigrateBlockContentBodyFieldTest
Attaches a body field to the custom block type.
@group block_content
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase extends \Drupal\migrate\MigrateMessageInterface implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase implements \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait implements \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\block_content\Kernel\Migrate\MigrateBlockContentBodyFieldTest implements \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase uses \Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait implements \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase implements \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase extends \Drupal\migrate\MigrateMessageInterface implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of MigrateBlockContentBodyFieldTest
File
-
core/
modules/ block_content/ tests/ src/ Kernel/ Migrate/ MigrateBlockContentBodyFieldTest.php, line 16
Namespace
Drupal\Tests\block_content\Kernel\MigrateView source
class MigrateBlockContentBodyFieldTest extends MigrateDrupal7TestBase {
protected static $modules = [
'block',
'block_content',
'filter',
'text',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->installEntitySchema('block_content');
$this->installConfig([
'block_content',
]);
$this->executeMigrations([
'block_content_type',
'block_content_body_field',
]);
}
/**
* Tests the block content body field migration.
*/
public function testBlockContentBodyFieldMigration() {
/** @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.