VariableTest.php

Same filename in this branch
  1. 8.9.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableTest.php
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/VariableTest.php
Same filename in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableTest.php
  2. 9 core/tests/Drupal/Tests/Component/Utility/VariableTest.php
  3. 10 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableTest.php
  4. 10 core/tests/Drupal/Tests/Component/Utility/VariableTest.php
  5. 11.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableTest.php
  6. 11.x core/tests/Drupal/Tests/Component/Utility/VariableTest.php

Namespace

Drupal\Tests\migrate_drupal\Unit\source

File

core/modules/migrate_drupal/tests/src/Unit/source/VariableTest.php

View source
<?php

namespace Drupal\Tests\migrate_drupal\Unit\source;

use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;

/**
 * Tests the variable source plugin.
 *
 * @group migrate_drupal
 */
class VariableTest extends MigrateSqlSourceTestCase {
    const PLUGIN_CLASS = 'Drupal\\migrate_drupal\\Plugin\\migrate\\source\\Variable';
    protected $migrationConfiguration = [
        'id' => 'test',
        'highWaterProperty' => [
            'field' => 'test',
        ],
        'source' => [
            'plugin' => 'd6_variable',
            'variables' => [
                'foo',
                'bar',
            ],
        ],
    ];
    protected $expectedResults = [
        [
            'id' => 'foo',
            'foo' => 1,
            'bar' => FALSE,
        ],
    ];
    protected $databaseContents = [
        'variable' => [
            [
                'name' => 'foo',
                'value' => 'i:1;',
            ],
            [
                'name' => 'bar',
                'value' => 'b:0;',
            ],
        ],
    ];

}

Classes

Title Deprecated Summary
VariableTest Tests the variable source plugin.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.