Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / comment / tests / src / Kernel / Migrate / MigrateCommentStubTest.php
1 <?php
2
3 namespace Drupal\Tests\comment\Kernel\Migrate;
4
5 use Drupal\comment\Entity\CommentType;
6 use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
7 use Drupal\migrate_drupal\Tests\StubTestTrait;
8 use Drupal\node\Entity\NodeType;
9
10 /**
11  * Test stub creation for comment entities.
12  *
13  * @group comment
14  */
15 class MigrateCommentStubTest extends MigrateDrupalTestBase {
16
17   use StubTestTrait;
18
19   /**
20    * {@inheritdoc}
21    */
22   public static $modules = ['comment', 'node'];
23
24   /**
25    * {@inheritdoc}
26    */
27   protected function setUp() {
28     parent::setUp();
29     $this->installEntitySchema('comment');
30     $this->installEntitySchema('node');
31     $this->installSchema('system', ['sequences']);
32
33     // Make sure uid 0 is created (default uid for comments is 0).
34     $storage = \Drupal::entityManager()->getStorage('user');
35     // Insert a row for the anonymous user.
36     $storage
37       ->create([
38         'uid' => 0,
39         'status' => 0,
40         'name' => '',
41       ])
42       ->save();
43     // Need at least one node type and comment type present.
44     NodeType::create([
45       'type' => 'testnodetype',
46       'name' => 'Test node type',
47     ])->save();
48     CommentType::create([
49       'id' => 'testcommenttype',
50       'label' => 'Test comment type',
51       'target_entity_type_id' => 'node',
52     ])->save();
53   }
54
55   /**
56    * Tests creation of comment stubs.
57    */
58   public function testStub() {
59     $this->performStubTest('comment');
60   }
61
62 }