Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / tests / src / Unit / Plugin / DMU / Analyzer / AnalyzerTestBase.php
1 <?php
2
3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Analyzer;
4
5 use Drupal\Tests\drupalmoduleupgrader\Unit\TestBase;
6
7 abstract class AnalyzerTestBase extends TestBase {
8
9   /**
10    * @var \Drupal\drupalmoduleupgrader\AnalyzerInterface
11    */
12   protected $analyzer;
13
14   /**
15    * {@inheritdoc}
16    */
17   protected function getPlugin(array $configuration = [], $plugin_definition = []) {
18     $plugin_definition += [
19       'message' => $this->getRandomGenerator()->sentences(4),
20       'summary' => NULL,
21       'documentation' => [],
22       'tags' => [],
23     ];
24     return parent::getPlugin($configuration, $plugin_definition);
25   }
26
27   /**
28    * Tests an issue generated by an analyzer to ensure that it has all the
29    * default values pulled from the plugin definition.
30    *
31    * @param $issue
32    *  The issue to test. Will be checked for IssueInterface conformance.
33    */
34   protected function assertIssueDefaults($issue) {
35     $this->assertInstanceOf('\Drupal\drupalmoduleupgrader\IssueInterface', $issue);
36
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']);
41   }
42
43 }