You are here

public function DrupalSqlBaseTest::testSourceDatabaseError in Drupal 8

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

@covers ::checkRequirements

File

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

Class

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

Namespace

Drupal\Tests\migrate_drupal\Unit\source

Code

public function testSourceDatabaseError() {
  $plugin_definition['requirements_met'] = TRUE;
  $plugin_definition['source_module'] = 'module1';

  /** @var \Drupal\Core\State\StateInterface $state */
  $state = $this
    ->createMock('Drupal\\Core\\State\\StateInterface');

  /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager */
  $entity_manager = $this
    ->createMock('Drupal\\Core\\Entity\\EntityTypeManagerInterface');
  $plugin = new TestDrupalSqlBase([], 'test', $plugin_definition, $this
    ->getMigration(), $state, $entity_manager);
  $system_data = $plugin
    ->getSystemData();
  $this
    ->expectException(RequirementsException::class);
  $this
    ->expectExceptionMessage('No database connection configured for source plugin test');
  $plugin
    ->checkRequirements();
}