3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Analyzer;
5 use Drupal\Tests\drupalmoduleupgrader\Unit\TestBase;
7 abstract class AnalyzerTestBase extends TestBase {
10 * @var \Drupal\drupalmoduleupgrader\AnalyzerInterface
17 protected function getPlugin(array $configuration = [], $plugin_definition = []) {
18 $plugin_definition += [
19 'message' => $this->getRandomGenerator()->sentences(4),
21 'documentation' => [],
24 return parent::getPlugin($configuration, $plugin_definition);
28 * Tests an issue generated by an analyzer to ensure that it has all the
29 * default values pulled from the plugin definition.
32 * The issue to test. Will be checked for IssueInterface conformance.
34 protected function assertIssueDefaults($issue) {
35 $this->assertInstanceOf('\Drupal\drupalmoduleupgrader\IssueInterface', $issue);
37 $plugin_definition = $this->analyzer->getPluginDefinition();
38 $this->assertEquals($plugin_definition['message'], $issue->getTitle());
39 $this->assertEquals($plugin_definition['summary'], $issue->getSummary());
40 $this->assertSame($issue->getDocumentation(), $plugin_definition['documentation']);