Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / file / tests / src / Kernel / Plugin / migrate / source / d6 / UploadTest.php
1 <?php
2
3 namespace Drupal\Tests\file\Kernel\Plugin\migrate\source\d6;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests D6 d6_upload source plugin.
9  *
10  * @covers \Drupal\file\Plugin\migrate\source\d6\Upload
11  *
12  * @group file
13  */
14 class UploadTest extends MigrateSqlSourceTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['file', 'migrate_drupal'];
20
21   /**
22    * {@inheritdoc}
23    */
24   public function providerSource() {
25     $tests = [];
26
27     // The source data.
28     $tests[0]['source_data']['upload'] = [
29       [
30         'fid' => '1',
31         'nid' => '1',
32         'vid' => '1',
33         'description' => 'file 1-1-1',
34         'list' => '0',
35         'weight' => '-1',
36       ],
37       [
38         'fid' => '3',
39         'nid' => '12',
40         'vid' => '15',
41         'description' => 'file 12-15-3',
42         'list' => '0',
43         'weight' => '0',
44       ],
45     ];
46
47     $tests[0]['source_data']['node'] = [
48       [
49         'nid' => '1',
50         'vid' => '1',
51         'type' => 'story',
52         'language' => '',
53         'title' => 'Test title',
54         'uid' => '1',
55         'status' => '1',
56         'created' => '1388271197',
57         'changed' => '1420861423',
58         'comment' => '0',
59         'promote' => '0',
60         'moderate' => '0',
61         'sticky' => '0',
62         'tnid' => '0',
63         'translate' => '0',
64       ],
65       [
66         'nid' => '12',
67         'vid' => '15',
68         'type' => 'page',
69         'language' => 'zu',
70         'title' => 'Abantu zulu',
71         'uid' => '1',
72         'status' => '1',
73         'created' => '1444238800',
74         'changed' => '1444238808',
75         'comment' => '0',
76         'promote' => '0',
77         'moderate' => '0',
78         'sticky' => '0',
79         'tnid' => '12',
80         'translate' => '0',
81       ],
82     ];
83
84     // The expected results.
85     $tests[0]['expected_data'] = [
86       [
87         'upload' => [
88           [
89             'fid' => '1',
90             'description' => 'file 1-1-1',
91             'list' => '0',
92           ],
93         ],
94         'language' => '',
95         'nid' => '1',
96         'vid' => '1',
97         'type' => 'story',
98       ],
99       [
100         'upload' => [
101           [
102             'fid' => '3',
103             'description' => 'file 12-15-3',
104             'list' => '0',
105           ],
106         ],
107         'language' => 'zu',
108         'nid' => '12',
109         'vid' => '15',
110         'type' => 'page',
111       ],
112     ];
113
114     return $tests;
115   }
116
117 }