function DrupalSqlBaseTest::testSourceProviderNotActive

Same name in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php \Drupal\Tests\migrate_drupal\Unit\source\DrupalSqlBaseTest::testSourceProviderNotActive()
  2. 8.9.x 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 80

Class

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

Namespace

Drupal\Tests\migrate_drupal\Unit\source

Code

public function testSourceProviderNotActive() : void {
    $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.