You are here

public function NotifyGrantEventTest::testNotifyGrantEvent in Ubercart 8.4

Same name in this branch
  1. 8.4 uc_file/tests/src/Unit/Integration/Event/NotifyGrantEventTest.php \Drupal\Tests\uc_file\Unit\Integration\Event\NotifyGrantEventTest::testNotifyGrantEvent()
  2. 8.4 uc_role/tests/src/Unit/Integration/Event/NotifyGrantEventTest.php \Drupal\Tests\uc_role\Unit\Integration\Event\NotifyGrantEventTest::testNotifyGrantEvent()

Tests the event metadata.

File

uc_file/tests/src/Unit/Integration/Event/NotifyGrantEventTest.php, line 41

Class

NotifyGrantEventTest
Checks that the event "uc_file_notify_grant" is correctly defined.

Namespace

Drupal\Tests\uc_file\Unit\Integration\Event

Code

public function testNotifyGrantEvent() {

  // Verify our event is discoverable.
  $event = $this->eventManager
    ->createInstance('uc_file_notify_grant');
  $order_context_definition = $event
    ->getContextDefinition('order');
  $this
    ->assertSame('entity:uc_order', $order_context_definition
    ->getDataType());
  $this
    ->assertSame('Order', $order_context_definition
    ->getLabel());
  $file_context_definition = $event
    ->getContextDefinition('expiration');
  $this
    ->assertSame('array', $file_context_definition
    ->getDataType());
  $this
    ->assertSame('File expiration', $file_context_definition
    ->getLabel());
}