26b95d7fcedef3050170100c33702e3fffe4cc4f
[yaffs-website] / web / core / modules / comment / tests / src / Kernel / Plugin / migrate / source / d6 / CommentSourceWithHighWaterTest.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 the Drupal 6 comment source w/ high water handling.
9  *
10  * @covers \Drupal\comment\Plugin\migrate\source\d6\Comment
11  *
12  * @group comment
13  */
14 class CommentSourceWithHighWaterTest extends MigrateSqlSourceTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['comment', 'migrate_drupal'];
20
21   /**
22    * {@inheritdoc}
23    */
24   public function providerSource() {
25     $tests = [];
26
27     // The source data.
28     $tests[0]['source_data']['comments'] = [
29       [
30         'cid' => 1,
31         'pid' => 0,
32         'nid' => 2,
33         'uid' => 3,
34         'subject' => 'subject value 1',
35         'comment' => 'comment value 1',
36         'hostname' => 'hostname value 1',
37         'timestamp' => 1382255613,
38         'status' => 0,
39         'thread' => '',
40         'name' => '',
41         'mail' => '',
42         'homepage' => '',
43         'format' => 'testformat1',
44         'type' => 'story',
45       ],
46       [
47         'cid' => 2,
48         'pid' => 1,
49         'nid' => 3,
50         'uid' => 4,
51         'subject' => 'subject value 2',
52         'comment' => 'comment value 2',
53         'hostname' => 'hostname value 2',
54         'timestamp' => 1382255662,
55         'status' => 0,
56         'thread' => '',
57         'name' => '',
58         'mail' => '',
59         'homepage' => '',
60         'format' => 'testformat2',
61         'type' => 'page',
62       ],
63     ];
64
65     $tests[0]['source_data']['node'] = [
66       [
67         'nid' => 2,
68         'type' => 'story',
69         'language' => 'en',
70       ],
71       [
72         'nid' => 3,
73         'type' => 'page',
74         'language' => 'fr',
75       ],
76     ];
77
78     // The expected results.
79     $tests[0]['expected_data'] = [
80       [
81         'cid' => 2,
82         'pid' => 1,
83         'nid' => 3,
84         'uid' => 4,
85         'subject' => 'subject value 2',
86         'comment' => 'comment value 2',
87         'hostname' => 'hostname value 2',
88         'timestamp' => 1382255662,
89         'status' => 1,
90         'thread' => '',
91         'name' => '',
92         'mail' => '',
93         'homepage' => '',
94         'format' => 'testformat2',
95         'type' => 'page',
96         'language' => 'fr',
97       ],
98     ];
99
100     // The expected count is the count returned by the query before the query
101     // is modified by SqlBase::initializeIterator().
102     $tests[0]['expected_count'] = 2;
103
104     $tests[0]['configuration']['high_water_property']['name'] = 'timestamp';
105     $tests[0]['high_water'] = $tests[0]['source_data']['comments'][0]['timestamp'];
106     return $tests;
107   }
108
109 }