You are here

public function CommentTypeRequirementsTest::testCheckCommentTypeRequirements in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/comment/tests/src/Kernel/Plugin/migrate/source/CommentTypeRequirementsTest.php \Drupal\Tests\comment\Kernel\Plugin\migrate\source\CommentTypeRequirementsTest::testCheckCommentTypeRequirements()

Tests thrown exceptions when node or comment aren't enabled on source.

@dataProvider providerTestCheckCommentTypeRequirements

Parameters

string[] $disabled_source_modules: List of the modules to disable in the source Drupal database.

string $exception_message: The expected message of the RequirementsException.

string $migration_plugin_id: The plugin ID of the comment type migration to test.

File

core/modules/comment/tests/src/Kernel/Plugin/migrate/source/CommentTypeRequirementsTest.php, line 32

Class

CommentTypeRequirementsTest
Tests check requirements for comment type source plugin.

Namespace

Drupal\Tests\comment\Kernel\Plugin\migrate\source

Code

public function testCheckCommentTypeRequirements(array $disabled_source_modules, string $exception_message, string $migration_plugin_id) {
  if (!empty($disabled_source_modules)) {
    $this->sourceDatabase
      ->update('system')
      ->condition('name', $disabled_source_modules, 'IN')
      ->fields([
      'status' => 0,
    ])
      ->execute();
  }
  $this
    ->expectException(RequirementsException::class);
  $this
    ->expectExceptionMessage($exception_message);
  $this
    ->getMigration($migration_plugin_id)
    ->getSourcePlugin()
    ->checkRequirements();
}