You are here

public function SqlBaseTest::sqlBaseTestProvider in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/SqlBaseTest.php \Drupal\Tests\migrate\Unit\SqlBaseTest::sqlBaseTestProvider()

The data provider for SqlBase.

Return value

array An array of data per test run.

File

core/modules/migrate/tests/src/Unit/SqlBaseTest.php, line 91
Contains \Drupal\Tests\migrate\Unit\SqlBaseTest.

Class

SqlBaseTest
Tests the SqlBase class.

Namespace

Drupal\Tests\migrate\Unit

Code

public function sqlBaseTestProvider() {
  return [
    // Source ids are empty so mapJoinable() is false.
    [
      FALSE,
      FALSE,
      FALSE,
    ],
    // Still false because getIdMap() is not a subclass of Sql.
    [
      FALSE,
      FALSE,
      TRUE,
    ],
    // Test mapJoinable() returns false when source and id connection options
    // differ.
    [
      FALSE,
      TRUE,
      TRUE,
      [
        'driver' => 'mysql',
        'username' => 'different_from_map',
        'password' => 'different_from_map',
      ],
      [
        'driver' => 'mysql',
        'username' => 'different_from_source',
        'password' => 'different_from_source',
      ],
    ],
    // Returns false because driver is pgsql and the databases are not the
    // same.
    [
      FALSE,
      TRUE,
      TRUE,
      [
        'driver' => 'pgsql',
        'database' => '1.pgsql',
        'username' => 'same_value',
        'password' => 'same_value',
      ],
      [
        'driver' => 'pgsql',
        'database' => '2.pgsql',
        'username' => 'same_value',
        'password' => 'same_value',
      ],
    ],
    // Returns false because driver is sqlite and the databases are not the
    // same.
    [
      FALSE,
      TRUE,
      TRUE,
      [
        'driver' => 'sqlite',
        'database' => '1.sqlite',
        'username' => '',
        'password' => '',
      ],
      [
        'driver' => 'sqlite',
        'database' => '2.sqlite',
        'username' => '',
        'password' => '',
      ],
    ],
    // Returns false because driver is not the same.
    [
      FALSE,
      TRUE,
      TRUE,
      [
        'driver' => 'pgsql',
        'username' => 'same_value',
        'password' => 'same_value',
      ],
      [
        'driver' => 'mysql',
        'username' => 'same_value',
        'password' => 'same_value',
      ],
    ],
  ];
}