Version 1
[yaffs-website] / web / core / modules / migrate_drupal / tests / src / Unit / source / VariableMultiRowTestBase.php
1 <?php
2
3 namespace Drupal\Tests\migrate_drupal\Unit\source;
4
5 use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
6
7 /**
8  * Base class for variable multirow source unit tests.
9  */
10 abstract class VariableMultiRowTestBase extends MigrateSqlSourceTestCase {
11
12   // The plugin system is not working during unit testing so the source plugin
13   // class needs to be manually specified.
14   const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\VariableMultiRow';
15
16   // The fake Migration configuration entity.
17   protected $migrationConfiguration = [
18     'id' => 'test',
19     'source' => [
20       'plugin' => 'd6_variable_multirow',
21       'variables' => [
22         'foo',
23         'bar',
24       ],
25     ],
26   ];
27
28   protected $expectedResults = [
29     ['name' => 'foo', 'value' => 1],
30     ['name' => 'bar', 'value' => FALSE],
31   ];
32
33   protected $databaseContents = [
34     'variable' => [
35       ['name' => 'foo', 'value' => 'i:1;'],
36       ['name' => 'bar', 'value' => 'b:0;'],
37     ],
38   ];
39
40 }