Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / taxonomy / tests / src / Kernel / Plugin / migrate / source / d6 / VocabularyTest.php
1 <?php
2
3 namespace Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6;
4
5 use Drupal\Core\Field\FieldStorageDefinitionInterface;
6 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
7
8 /**
9  * Tests D6 vocabulary source plugin.
10  *
11  * @covers \Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary
12  * @group taxonomy
13  */
14 class VocabularyTest extends MigrateSqlSourceTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['taxonomy', 'migrate_drupal'];
20
21   /**
22    * {@inheritdoc}
23    */
24   public function providerSource() {
25     $tests = [];
26
27     // The source data.
28     $tests[0]['source_data']['vocabulary'] = [
29       [
30         'vid' => 1,
31         'name' => 'Tags',
32         'description' => 'Tags description.',
33         'help' => 1,
34         'relations' => 0,
35         'hierarchy' => 0,
36         'multiple' => 0,
37         'required' => 0,
38         'tags' => 1,
39         'module' => 'taxonomy',
40         'weight' => 0,
41       ],
42       [
43         'vid' => 2,
44         'name' => 'Categories',
45         'description' => 'Categories description.',
46         'help' => 1,
47         'relations' => 1,
48         'hierarchy' => 1,
49         'multiple' => 0,
50         'required' => 1,
51         'tags' => 0,
52         'module' => 'taxonomy',
53         'weight' => 0,
54       ],
55     ];
56     $tests[0]['source_data']['vocabulary_node_types'] = [
57       [
58         'vid' => 1,
59         'type' => 'page',
60       ],
61       [
62         'vid' => 1,
63         'type' => 'article',
64       ],
65       [
66         'vid' => 2,
67         'type' => 'article',
68       ],
69     ];
70
71     // The expected results.
72     $tests[0]['expected_data'] = [
73       [
74         'vid' => 1,
75         'name' => 'Tags',
76         'description' => 'Tags description.',
77         'help' => 1,
78         'relations' => 0,
79         'hierarchy' => 0,
80         'multiple' => 0,
81         'required' => 0,
82         'tags' => 1,
83         'module' => 'taxonomy',
84         'weight' => 0,
85         'node_types' => ['page', 'article'],
86         'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
87       ],
88       [
89         'vid' => 2,
90         'name' => 'Categories',
91         'description' => 'Categories description.',
92         'help' => 1,
93         'relations' => 1,
94         'hierarchy' => 1,
95         'multiple' => 0,
96         'required' => 1,
97         'tags' => 0,
98         'module' => 'taxonomy',
99         'weight' => 0,
100         'node_types' => ['article'],
101         'cardinality' => 1,
102       ],
103     ];
104
105     return $tests;
106   }
107
108 }