function DrupalSqlBaseTest::testSourceProviderNotActive

Same name in other branches
  1. 8.9.x core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php \Drupal\Tests\migrate_drupal\Unit\source\DrupalSqlBaseTest::testSourceProviderNotActive()
  2. 10 core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php \Drupal\Tests\migrate_drupal\Unit\source\DrupalSqlBaseTest::testSourceProviderNotActive()
  3. 11.x core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php \Drupal\Tests\migrate_drupal\Unit\source\DrupalSqlBaseTest::testSourceProviderNotActive()

@covers ::checkRequirements

File

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

Class

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

Namespace

Drupal\Tests\migrate_drupal\Unit\source

Code

public function testSourceProviderNotActive() {
    $plugin = new TestDrupalSqlBase([], 'placeholder_id', $this->pluginDefinition, $this->getMigration(), $this->state, $this->entityTypeManager);
    $plugin->setDatabase($this->getDatabase($this->databaseContents));
    $this->expectException(RequirementsException::class);
    $this->expectExceptionMessage('The module module1 is not enabled in the source site.');
    try {
        $plugin->checkRequirements();
    } catch (RequirementsException $e) {
        // Ensure requirements are set on the exception.
        $this->assertEquals([
            'source_module' => 'module1',
        ], $e->getRequirements());
        // Re-throw so PHPUnit can assert the exception.
        throw $e;
    }
}

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