parent::
setUp();
$this->pluginDefinition
['requirements_met'
] = TRUE;
$this->pluginDefinition
['source_module'
] = 'module1';
$this->state =
$this->
createMock('Drupal\Core\State\StateInterface'
);
$this->entityTypeManager =
$this->
createMock('Drupal\Core\Entity\EntityTypeManagerInterface'
);
} /**
* @covers ::checkRequirements
*/
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;
}