You are here

public function DrupalSqlBaseTest::testMinimumVersion in Drupal 9

@covers ::checkRequirements

@dataProvider providerMinimumVersion

Parameters

bool $success: True if this test will not throw an exception.

null|string $minimum_version: The minimum version declared in the configuration of a source plugin.

string $schema_version: The schema version for the source module declared in a source plugin.

File

core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php, line 116

Class

DrupalSqlBaseTest
@coversDefaultClass \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase @group migrate_drupal

Namespace

Drupal\Tests\migrate_drupal\Unit\source

Code

public function testMinimumVersion($success, $minimum_version, $schema_version) {
  $this->pluginDefinition['minimum_version'] = $minimum_version;
  $this->databaseContents['system'][0]['status'] = 1;
  $this->databaseContents['system'][0]['schema_version'] = $schema_version;
  $plugin = new TestDrupalSqlBase([], 'test', $this->pluginDefinition, $this
    ->getMigration(), $this->state, $this->entityTypeManager);
  $plugin
    ->setDatabase($this
    ->getDatabase($this->databaseContents));
  if (!$success) {
    $this
      ->expectException(RequirementsException::class);
    $this
      ->expectExceptionMessage("Required minimum version {$minimum_version}");
  }
  $plugin
    ->checkRequirements();
}