Version 1
[yaffs-website] / web / core / modules / comment / tests / src / Kernel / Plugin / migrate / source / d6 / CommentTest.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 D6 comment source plugin.
9  *
10  * @covers \Drupal\comment\Plugin\migrate\source\d6\Comment
11  * @group comment
12  */
13 class CommentTest 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']['comments'] = [
28       [
29         'cid' => 1,
30         'pid' => 0,
31         'nid' => 2,
32         'uid' => 3,
33         'subject' => 'subject value 1',
34         'comment' => 'comment value 1',
35         'hostname' => 'hostname value 1',
36         'timestamp' => 1382255613,
37         'status' => 0,
38         'thread' => '',
39         'name' => '',
40         'mail' => '',
41         'homepage' => '',
42         'format' => 'testformat1',
43         'type' => 'story',
44       ],
45       [
46         'cid' => 2,
47         'pid' => 1,
48         'nid' => 3,
49         'uid' => 4,
50         'subject' => 'subject value 2',
51         'comment' => 'comment value 2',
52         'hostname' => 'hostname value 2',
53         'timestamp' => 1382255662,
54         'status' => 0,
55         'thread' => '',
56         'name' => '',
57         'mail' => '',
58         'homepage' => '',
59         'format' => 'testformat2',
60         'type' => 'page',
61       ],
62     ];
63
64     $tests[0]['source_data']['node'] = [
65       [
66         'nid' => 2,
67         'type' => 'story',
68       ],
69       [
70         'nid' => 3,
71         'type' => 'page',
72       ],
73     ];
74
75     // The expected results.
76     $tests[0]['expected_data'] = [
77       [
78         'cid' => 1,
79         'pid' => 0,
80         'nid' => 2,
81         'uid' => 3,
82         'subject' => 'subject value 1',
83         'comment' => 'comment value 1',
84         'hostname' => 'hostname value 1',
85         'timestamp' => 1382255613,
86         'status' => 1,
87         'thread' => '',
88         'name' => '',
89         'mail' => '',
90         'homepage' => '',
91         'format' => 'testformat1',
92         'type' => 'story',
93       ],
94       [
95         'cid' => 2,
96         'pid' => 1,
97         'nid' => 3,
98         'uid' => 4,
99         'subject' => 'subject value 2',
100         'comment' => 'comment value 2',
101         'hostname' => 'hostname value 2',
102         'timestamp' => 1382255662,
103         'status' => 1,
104         'thread' => '',
105         'name' => '',
106         'mail' => '',
107         'homepage' => '',
108         'format' => 'testformat2',
109         'type' => 'page',
110       ],
111     ];
112
113     return $tests;
114   }
115
116 }