You are here

public function TokenEventTest::testTokenReplacementEventInvalidReplacementException in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/core_event_dispatcher/tests/src/Unit/Token/TokenEventTest.php \Drupal\Tests\core_event_dispatcher\Unit\Token\TokenEventTest::testTokenReplacementEventInvalidReplacementException()

Test TokenReplacementEvent invalid replacement Exception.

File

modules/core_event_dispatcher/tests/src/Unit/Token/TokenEventTest.php, line 182

Class

TokenEventTest
Class TokenEventTest.

Namespace

Drupal\Tests\core_event_dispatcher\Unit\Token

Code

public function testTokenReplacementEventInvalidReplacementException() : void {
  $metaData = $this
    ->createMock(BubbleableMetadata::class);
  $event = new TokensReplacementEvent('test', [
    'token' => '[test:token]',
  ], [], [], $metaData);
  $this
    ->expectException(UnexpectedValueException::class);
  $event
    ->setReplacementValue('test', 'token', NULL);
}