TamperPluginTestBase.php in Tamper 8
File
tests/src/Unit/Plugin/Tamper/TamperPluginTestBase.php
View source
<?php
namespace Drupal\Tests\tamper\Unit\Plugin\Tamper;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\tamper\SourceDefinitionInterface;
use Drupal\Tests\UnitTestCase;
abstract class TamperPluginTestBase extends UnitTestCase {
protected $plugin;
protected function setUp() {
$this->plugin = $this
->instantiatePlugin();
$this->plugin
->setStringTranslation($this
->createMock(TranslationInterface::class));
parent::setUp();
}
protected abstract function instantiatePlugin();
protected function getMockSourceDefinition() {
$mock = $this
->createMock(SourceDefinitionInterface::class);
$mock
->expects($this
->any())
->method('getList')
->willReturn([
'foo',
'bar',
]);
return $mock;
}
public function testGetPluginId() {
$this
->assertIsString($this->plugin
->getPluginId());
}
public function testGetPluginDefinition() {
$this
->assertIsArray($this->plugin
->getPluginDefinition());
}
public function testGetConfiguration() {
$this
->assertIsArray($this->plugin
->getConfiguration());
}
public function testDefaultConfiguration() {
$this
->assertIsArray($this->plugin
->defaultConfiguration());
}
public function testBuildConfigurationForm() {
$this
->assertIsArray($this->plugin
->buildConfigurationForm([], $this
->createMock(FormStateInterface::class)));
}
public function testMultiple() {
$this
->assertIsBool($this->plugin
->multiple());
}
}