class MigrateCommentEntityDisplayTest
Same name in this branch
- 9 core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityDisplayTest.php \Drupal\Tests\comment\Kernel\Migrate\d6\MigrateCommentEntityDisplayTest
Same name and namespace in other branches
- 11.x core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentEntityDisplayTest.php \Drupal\Tests\comment\Kernel\Migrate\d6\MigrateCommentEntityDisplayTest
- 11.x core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityDisplayTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentEntityDisplayTest
Tests the migration of comment entity displays from Drupal 7.
@group comment @group migrate_drupal_7
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\comment\Kernel\Migrate\d7\MigrateCommentEntityDisplayTest 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 MigrateCommentEntityDisplayTest
File
-
core/
modules/ comment/ tests/ src/ Kernel/ Migrate/ d7/ MigrateCommentEntityDisplayTest.php, line 14
Namespace
Drupal\Tests\comment\Kernel\Migrate\d7View source
class MigrateCommentEntityDisplayTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'comment',
'text',
'menu_ui',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->migrateContentTypes();
$this->migrateCommentTypes();
$this->executeMigrations([
'd7_comment_field',
'd7_comment_field_instance',
'd7_comment_entity_display',
]);
}
/**
* Asserts various aspects of a comment component in an entity view display.
*
* @param string $id
* The entity ID.
* @param string $component_id
* The ID of the display component.
*
* @internal
*/
protected function assertDisplay(string $id, string $component_id) : void {
$component = EntityViewDisplay::load($id)->getComponent($component_id);
$this->assertIsArray($component);
$this->assertSame('hidden', $component['label']);
$this->assertSame('comment_default', $component['type']);
$this->assertSame(20, $component['weight']);
}
/**
* Tests the migrated display configuration.
*/
public function testMigration() {
$this->assertDisplay('node.page.default', 'comment_node_page');
$this->assertDisplay('node.article.default', 'comment_node_article');
$this->assertDisplay('node.book.default', 'comment_node_book');
$this->assertDisplay('node.blog.default', 'comment_node_blog');
$this->assertDisplay('node.forum.default', 'comment_forum');
$this->assertDisplay('node.test_content_type.default', 'comment_node_test_content_type');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.