Version 1
[yaffs-website] / web / core / modules / migrate_drupal / tests / src / Kernel / Plugin / migrate / source / d6 / i18nVariableTest.php
1 <?php
2
3 namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d6;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests the variable source plugin.
9  *
10  * @covers \Drupal\migrate_drupal\Plugin\migrate\source\d6\i18nVariable
11  *
12  * @group migrate_drupal
13  */
14 class i18nVariableTest extends MigrateSqlSourceTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['migrate_drupal'];
20
21   /**
22    * {@inheritdoc}
23    */
24   public function providerSource() {
25     $tests = [];
26
27     // The source data.
28     $tests[0]['source_data']['i18n_variable'] = [
29       [
30         'name' => 'site_slogan',
31         'language' => 'fr',
32         'value' => 's:19:"Migrate est génial";',
33       ],
34       [
35         'name' => 'site_name',
36         'language' => 'fr',
37         'value' => 's:11:"nom de site";',
38       ],
39       [
40         'name' => 'site_slogan',
41         'language' => 'mi',
42         'value' => 's:19:"Ko whakamataku heke";',
43       ],
44       [
45         'name' => 'site_name',
46         'language' => 'mi',
47         'value' => 's:9:"ingoa_pae";',
48       ],
49     ];
50
51     // The expected results.
52     $tests[0]['expected_data'] = [
53       [
54         'language' => 'fr',
55         'site_slogan' => 'Migrate est génial',
56         'site_name' => 'nom de site',
57       ],
58       [
59         'language' => 'mi',
60         'site_slogan' => 'Ko whakamataku heke',
61         'site_name' => 'ingoa_pae',
62       ],
63     ];
64
65     // The expected count.
66     $tests[0]['expected_count'] = NULL;
67
68     // The migration configuration.
69     $tests[0]['configuration']['variables'] = [
70       'site_slogan',
71       'site_name',
72     ];
73
74     return $tests;
75   }
76
77 }