Version 1
[yaffs-website] / web / core / modules / migrate_drupal / tests / src / Unit / source / d6 / i18nVariableTest.php
1 <?php
2
3 namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
4
5 use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
6
7 /**
8  * Tests the variable source plugin.
9  *
10  * @group migrate_drupal
11  */
12 class i18nVariableTest extends MigrateSqlSourceTestCase {
13
14   // The plugin system is not working during unit testing so the source plugin
15   // class needs to be manually specified.
16   const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\i18nVariable';
17
18   /**
19    * Define bare minimum migration configuration.
20    */
21   protected $migrationConfiguration = [
22     'id' => 'test',
23     'highWaterProperty' => ['field' => 'test'],
24     'source' => [
25       'plugin' => 'i18n_variable',
26       'variables' => [
27         'site_slogan',
28         'site_name',
29       ],
30     ],
31   ];
32
33   /**
34    * Expected results from the source.
35    */
36   protected $expectedResults = [
37     [
38       'language' => 'fr',
39       'site_slogan' => 'Migrate est génial',
40       'site_name' => 'nom de site',
41     ],
42     [
43       'language' => 'mi',
44       'site_slogan' => 'Ko whakamataku heke',
45       'site_name' => 'ingoa_pae',
46     ]
47   ];
48
49   /**
50    * Database contents for tests.
51    */
52   protected $databaseContents = [
53     'i18n_variable' => [
54       ['name' => 'site_slogan', 'language' => 'fr', 'value' => 's:19:"Migrate est génial";'],
55       ['name' => 'site_name', 'language' => 'fr', 'value' => 's:11:"nom de site";'],
56       ['name' => 'site_slogan', 'language' => 'mi', 'value' => 's:19:"Ko whakamataku heke";'],
57       ['name' => 'site_name', 'language' => 'mi', 'value' => 's:9:"ingoa_pae";'],
58     ],
59   ];
60
61 }