Updated to Drupal 8.6.4, which is PHP 7.3 friendly. Also updated HTMLaw library....
[yaffs-website] / web / core / modules / comment / tests / src / Kernel / Migrate / d6 / MigrateCommentFieldTest.php
1 <?php
2
3 namespace Drupal\Tests\comment\Kernel\Migrate\d6;
4
5 use Drupal\field\Entity\FieldStorageConfig;
6 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
7
8 /**
9  * Tests the migration of comment fields from Drupal 6.
10  *
11  * @group comment
12  * @group migrate_drupal_6
13  */
14 class MigrateCommentFieldTest extends MigrateDrupal6TestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['comment', 'menu_ui'];
20
21   /**
22    * {@inheritdoc}
23    */
24   protected function setUp() {
25     parent::setUp();
26     $this->installConfig(['comment']);
27     $this->executeMigrations([
28       'd6_comment_type',
29       'd6_comment_field',
30     ]);
31   }
32
33   /**
34    * Asserts a comment field entity.
35    *
36    * @param string $comment_type
37    *   The comment type.
38    */
39   protected function assertEntity($comment_type) {
40     $entity = FieldStorageConfig::load('node.' . $comment_type);
41     $this->assertInstanceOf(FieldStorageConfig::class, $entity);
42     $this->assertSame('node', $entity->getTargetEntityTypeId());
43     $this->assertSame('comment', $entity->getType());
44     $this->assertSame($comment_type, $entity->getSetting('comment_type'));
45   }
46
47   /**
48    * Tests the migrated comment fields.
49    */
50   public function testMigration() {
51     $this->assertEntity('comment_node_article');
52     $this->assertEntity('comment_node_company');
53     $this->assertEntity('comment_node_employee');
54     $this->assertEntity('comment_node_event');
55     $this->assertEntity('comment_forum');
56     $this->assertEntity('comment_node_page');
57     $this->assertEntity('comment_node_sponsor');
58     $this->assertEntity('comment_node_story');
59     $this->assertEntity('comment_node_test_event');
60     $this->assertEntity('comment_node_test_page');
61     $this->assertEntity('comment_node_test_planet');
62     $this->assertEntity('comment_node_test_story');
63   }
64
65 }