You are here

public function OtherEventVariablesTest::testViewTableEvent in Hook Event Dispatcher 8

Test a ViewTablePreprocessEvent.

File

tests/src/Unit/Preprocess/OtherEventVariablesTest.php, line 192

Class

OtherEventVariablesTest
Class OtherEventVariablesTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Preprocess

Code

public function testViewTableEvent() {
  $variablesArray = $this
    ->createVariablesArray();
  $variablesArray['rows'] = 'rows';
  $variablesArray['view'] = 'view';

  /** @var \Drupal\hook_event_dispatcher\Event\Preprocess\Variables\ViewTableEventVariables $variables */
  $variables = $this
    ->getVariablesFromCreatedEvent(ViewTablePreprocessEvent::class, $variablesArray);
  self::assertInstanceOf(ViewTableEventVariables::class, $variables);
  $this
    ->assertAbstractEventVariables($variables);
  self::assertSame('rows', $variables
    ->getRows());
  self::assertSame('view', $variables
    ->getView());
}