Version 1
[yaffs-website] / web / core / modules / comment / tests / src / Kernel / Plugin / migrate / source / d6 / CommentVariablePerCommentTypeTest.php
1 <?php
2
3 namespace Drupal\Tests\comment\Kernel\Plugin\migrate\source\d6;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests comment variable per comment type source plugin.
9  *
10  * @covers \Drupal\comment\Plugin\migrate\source\d6\CommentVariablePerCommentType
11  * @group comment
12  */
13 class CommentVariablePerCommentTypeTest extends MigrateSqlSourceTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['comment', 'migrate_drupal'];
19
20   /**
21    * {@inheritdoc}
22    */
23   public function providerSource() {
24     $tests = [];
25
26     // The source data.
27     $tests[0]['source_data']['node_type'] = [
28       [
29         'type' => 'page',
30       ],
31       [
32         'type' => 'story',
33       ],
34     ];
35
36     $tests[0]['source_data']['variable'] = [
37       [
38         'name' => 'comment_subject_field_page',
39         'value' => serialize(1),
40       ],
41       [
42         'name' => 'comment_subject_field_story',
43         'value' => serialize(0),
44       ],
45     ];
46
47     // The expected results.
48     // Each result will also include a label and description, but those are
49     // static values set by the source plugin and don't need to be asserted.
50     $tests[0]['expected_data'] = [
51       [
52         'comment_type' => 'comment',
53       ],
54       [
55         'comment_type' => 'comment_no_subject',
56       ],
57     ];
58
59     return $tests;
60   }
61
62 }