function SettingsTest::providerTestCredentialForm

Same name in other branches
  1. 10 core/modules/migrate_drupal_ui/tests/src/FunctionalJavascript/SettingsTest.php \Drupal\Tests\migrate_drupal_ui\FunctionalJavascript\SettingsTest::providerTestCredentialForm()
  2. 11.x core/modules/migrate_drupal_ui/tests/src/FunctionalJavascript/SettingsTest.php \Drupal\Tests\migrate_drupal_ui\FunctionalJavascript\SettingsTest::providerTestCredentialForm()

Data provider for testCredentialForm.

File

core/modules/migrate_drupal_ui/tests/src/FunctionalJavascript/SettingsTest.php, line 140

Class

SettingsTest
Tests migrate upgrade credential form with settings in settings.php.

Namespace

Drupal\Tests\migrate_drupal_ui\FunctionalJavascript

Code

public function providerTestCredentialForm() {
    return [
        'no values in settings.php' => [
            'source_connection' => "",
            'version' => '7',
            'manual' => [
                'host' => '172.18.0.2',
                'database' => 'drupal7',
                'username' => 'kate',
                'password' => 'pwd',
            ],
            'databases' => [],
            'expected_source_connection' => '',
        ],
        'single database in settings, migrate' => [
            'source_connection' => 'migrate',
            'version' => '7',
            'manual' => [],
            'databases' => [
                'migrate' => [
                    'default' => [
                        'database' => 'drupal7',
                        'username' => 'user',
                        'password' => 'pwd',
                        'prefix' => 'test',
                        'host' => '172.18.0.3',
                        'port' => '3307',
                        'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
                        'driver' => 'mysql',
                    ],
                ],
            ],
            'expected_source_connection' => 'migrate',
        ],
        'migrate_source_connection not set' => [
            'source_connection' => '',
            'version' => '7',
            'manual' => [],
            'databases' => [
                'migrate' => [
                    'default' => [
                        'database' => 'drupal7',
                        'username' => 'user',
                        'password' => 'pwd',
                        'prefix' => 'test',
                        'host' => '172.18.0.3',
                        'port' => '3307',
                        'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
                        'driver' => 'mysql',
                    ],
                ],
            ],
            'expected_source_connection' => 'migrate',
        ],
        'single database in settings, legacy' => [
            'source_connection' => 'legacy',
            'version' => '6',
            'manual' => [],
            'databases' => [
                'legacy' => [
                    'default' => [
                        'database' => 'drupal6',
                        'username' => 'user',
                        'password' => 'pwd',
                        'prefix' => 'test',
                        'host' => '172.18.0.6',
                        'port' => '3307',
                        'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
                        'driver' => 'mysql',
                    ],
                ],
            ],
            'expected_source_connection' => 'legacy',
        ],
        'two databases in settings' => [
            'source_connection' => 'source2',
            'version' => '7',
            'manual' => [],
            'databases' => [
                'migrate' => [
                    'default' => [
                        'database' => 'drupal7',
                        'username' => 'user',
                        'password' => 'pwd',
                        'prefix' => 'test',
                        'host' => '172.18.0.3',
                        'port' => '3307',
                        'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
                        'driver' => 'mysql',
                    ],
                ],
                'legacy' => [
                    'default' => [
                        'database' => 'site',
                        'username' => 'user',
                        'password' => 'pwd',
                        'prefix' => 'test',
                        'host' => '172.18.0.2',
                        'port' => '3307',
                        'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
                        'driver' => 'mysql',
                    ],
                ],
            ],
            'expected_source_connection' => 'migrate',
        ],
        'database in settings, but use manual' => [
            'source_connection' => '',
            'version' => '7',
            'manual' => [
                'host' => '172.18.0.2',
                'database' => 'drupal7',
                'username' => 'kate',
                'password' => 'pwd',
            ],
            'databases' => [
                'legacy' => [
                    'default' => [
                        'database' => 'site',
                        'username' => 'user',
                        'password' => 'pwd',
                        'prefix' => 'test',
                        'host' => '172.18.0.2',
                        'port' => '3307',
                        'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
                        'driver' => 'mysql',
                    ],
                ],
            ],
            'expected_source_connection' => '',
        ],
    ];
}

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