You are here

public function PathEventTest::testPathUpdateEvent in Hook Event Dispatcher 8

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::testPathUpdateEvent()
  2. 3.x modules/path_event_dispatcher/tests/src/Unit/Path/PathEventTest.php \Drupal\Tests\hook_event_dispatcher\Unit\Path\PathEventTest::testPathUpdateEvent()

Test PathUpdateEvent.

File

tests/src/Unit/Path/PathEventTest.php, line 93

Class

PathEventTest
Class PathEventTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Path

Code

public function testPathUpdateEvent() {
  $source = 'testSource';
  $alias = 'testAlias';
  $langcode = 'NL';
  $pid = 1337;
  $path = [
    'source' => $source,
    'alias' => $alias,
    'langcode' => $langcode,
    'pid' => $pid,
  ];
  hook_event_dispatcher_path_update($path);

  /** @var \Drupal\hook_event_dispatcher\Event\Path\PathUpdateEvent $event */
  $event = $this->manager
    ->getRegisteredEvent(HookEventDispatcherInterface::PATH_UPDATE);
  self::assertEquals($source, $event
    ->getSource());
  self::assertEquals($alias, $event
    ->getAlias());
  self::assertEquals($langcode, $event
    ->getLangcode());
  self::assertEquals($pid, $event
    ->getPid());
}