Version 1
[yaffs-website] / web / core / modules / node / tests / src / Kernel / Plugin / migrate / source / d7 / NodeTypeTest.php
1 <?php
2
3 namespace Drupal\Tests\node\Kernel\Plugin\migrate\source\d7;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests D7 node type source plugin.
9  *
10  * @covers \Drupal\node\Plugin\migrate\source\d7\NodeType
11  *
12  * @group node
13  */
14 class NodeTypeTest extends MigrateSqlSourceTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['node', 'user', 'migrate_drupal'];
20
21   /**
22    * {@inheritdoc}
23    */
24   public function providerSource() {
25     $tests = [];
26
27     // The source data.
28     $tests[0]['source_data']['node_type'] = [
29       [
30         'type' => 'page',
31         'name' => 'Page',
32         'base' => 'node',
33         'description' => 'A <em>page</em>, similar in form to a <em>story</em>, is a simple method for creating and displaying information that rarely changes, such as an "About us" section of a website. By default, a <em>page</em> entry does not allow visitor comments and is not featured on the site\'s initial home page.',
34         'help' => '',
35         'title_label' => 'Title',
36         'custom' => 1,
37         'modified' => 0,
38         'locked' => 0,
39         'disabled' => 0,
40         'orig_type' => 'page',
41       ],
42       [
43         'type' => 'story',
44         'name' => 'Story',
45         'base' => 'node',
46         'description' => 'A <em>story</em>, similar in form to a <em>page</em>, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a <em>story</em> entry. By default, a <em>story</em> entry is automatically featured on the site\'s initial home page, and provides the ability to post comments.',
47         'help' => '',
48         'title_label' => 'Title',
49         'custom' => 1,
50         'modified' => 0,
51         'locked' => 0,
52         'disabled' => 0,
53         'orig_type' => 'story',
54       ],
55     ];
56     $tests[0]['source_data']['variable'] = [
57       [
58         'name' => 'node_options_page',
59         'value' => 'a:1:{i:0;s:6:"status";}',
60       ],
61       [
62         'name' => 'node_options_story',
63         'value' => 'a:1:{i:0;s:6:"status";}',
64       ],
65     ];
66     $tests[0]['source_data']['field_config_instance'] = [
67       [
68         'entity_type' => 'node',
69         'bundle' => 'page',
70         'field_name' => 'body',
71         'data' => 'a:1:{s:5:"label";s:4:"Body";}',
72       ],
73       [
74         'entity_type' => 'node',
75         'bundle' => 'story',
76         'field_name' => 'body',
77         'data' => 'a:1:{s:5:"label";s:4:"Body";}',
78       ],
79     ];
80
81     // The expected results.
82     $tests[0]['expected_data'] = $tests[0]['source_data']['node_type'];
83
84     return $tests;
85   }
86
87 }