protected function BlockStyleBaseTest::setUp in Block Style Plugins 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/Plugin/BlockStyleBaseTest.php \Drupal\Tests\block_style_plugins\Unit\Plugin\BlockStyleBaseTest::setUp()
Create the setup for constants and configFactory stub.
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ Plugin/ BlockStyleBaseTest.php, line 61
Class
- BlockStyleBaseTest
- @coversDefaultClass \Drupal\block_style_plugins\Plugin\BlockStyleBase @group block_style_plugins
Namespace
Drupal\Tests\block_style_plugins\Unit\PluginCode
protected function setUp() {
parent::setUp();
// Stub the Iconset Finder Service.
$this->entityRepository = $this
->prophesize(EntityRepositoryInterface::CLASS);
// Stub the Entity Type Manager.
$this->entityTypeManager = $this
->prophesize(EntityTypeManagerInterface::CLASS);
// Form state double.
$this->formState = $this
->prophesize(FormStateInterface::CLASS);
// Block plugin.
$this->blockPlugin = $this
->prophesize(BlockPluginInterface::CLASS);
$this->blockPlugin
->getBaseId()
->willReturn('block_content');
$this->blockPlugin
->getDerivativeId()
->willReturn('uuid-1234');
$this->blockPlugin
->getPluginId()
->willReturn('basic_block');
$configuration = [];
$plugin_id = 'block_style_plugins';
$plugin_definition['provider'] = 'block_style_plugins';
$this->plugin = new MockBlockStyleBase($configuration, $plugin_id, $plugin_definition, $this->entityRepository
->reveal(), $this->entityTypeManager
->reveal());
// Create a translation stub for the t() method.
$translator = $this
->getStringTranslationStub();
$this->plugin
->setStringTranslation($translator);
}