function CommentTypeRequirementsTest::testCheckCommentTypeRequirements

Same name 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()
  2. 11.x 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 35

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) : void {
    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();
}

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