function DrupalSqlBaseTest::testMinimumVersion

Same name in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php \Drupal\Tests\migrate_drupal\Unit\source\DrupalSqlBaseTest::testMinimumVersion()
  2. 10 core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php \Drupal\Tests\migrate_drupal\Unit\source\DrupalSqlBaseTest::testMinimumVersion()

@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 122

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) : void {
    $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));
    $this->assertSame([], $plugin->fields());
    if (!$success) {
        $this->expectException(RequirementsException::class);
        $this->expectExceptionMessage("Required minimum version {$minimum_version}");
    }
    $plugin->checkRequirements();
}

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