You are here

public function OtherEventVariablesTest::testBlockEventWithBlockContent in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/preprocess_event_dispatcher/tests/src/Unit/OtherEventVariablesTest.php \Drupal\Tests\preprocess_event_dispatcher\Unit\OtherEventVariablesTest::testBlockEventWithBlockContent()

Test a BlockPreprocessEvent with block content entity.

File

modules/preprocess_event_dispatcher/tests/src/Unit/OtherEventVariablesTest.php, line 89

Class

OtherEventVariablesTest
Class OtherEventVariablesTest.

Namespace

Drupal\Tests\preprocess_event_dispatcher\Unit

Code

public function testBlockEventWithBlockContent() : void {
  $variablesArray = $this
    ->createVariablesArray();
  $blockContent = Mockery::mock(BlockContentInterface::class);
  $variablesArray['content']['#block_content'] = $blockContent;

  /** @var \Drupal\preprocess_event_dispatcher\Variables\BlockEventVariables $variables */
  $variables = $this
    ->getVariablesFromCreatedEvent(BlockPreprocessEvent::class, $variablesArray);
  self::assertInstanceOf(BlockEventVariables::class, $variables);
  $this
    ->assertAbstractEventVariables($variables);
  self::assertSame($blockContent, $variables
    ->getBlockContent());
}