You are here

public function PathEventTest::testPathDeleteEventWithoutRedirect in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/path_event_dispatcher/tests/src/Unit/Path/PathEventTest.php \Drupal\Tests\hook_event_dispatcher\Unit\Path\PathEventTest::testPathDeleteEventWithoutRedirect()

Test PathDeleteEvent.

File

modules/path_event_dispatcher/tests/src/Unit/Path/PathEventTest.php, line 69

Class

PathEventTest
Class PathEventTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Path

Code

public function testPathDeleteEventWithoutRedirect() : void {
  $source = 'testSource';
  $alias = 'testAlias';
  $langcode = 'NL';
  $pid = 1337;
  $path = [
    'source' => $source,
    'alias' => $alias,
    'langcode' => $langcode,
    'pid' => $pid,
  ];
  path_event_dispatcher_path_delete($path);

  /** @var \Drupal\path_event_dispatcher\Event\Path\PathDeleteEvent $event */
  $event = $this->manager
    ->getRegisteredEvent(HookEventDispatcherInterface::PATH_DELETE);
  self::assertSame($source, $event
    ->getSource());
  self::assertSame($alias, $event
    ->getAlias());
  self::assertSame($langcode, $event
    ->getLangcode());
  self::assertSame($pid, $event
    ->getPid());
  self::assertFalse($event
    ->isRedirect());
}