You are here

protected function BlockStyleBaseTest::setUp in Block Style Plugins 8.2

Same name and namespace in other branches
  1. 8 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 50

Class

BlockStyleBaseTest
@coversDefaultClass \Drupal\block_style_plugins\Plugin\BlockStyleBase @group block_style_plugins

Namespace

Drupal\Tests\block_style_plugins\Unit\Plugin

Code

protected function setUp() : void {
  parent::setUp();

  // 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->entityTypeManager
    ->reveal());

  // Create a translation stub for the t() method.
  $translator = $this
    ->getStringTranslationStub();
  $this->plugin
    ->setStringTranslation($translator);
}