You are here

class MockHeaderSubscriber in Akamai 8.3

Mock Event Subscriber for testing.

Hierarchy

  • class \Drupal\Tests\akamai\Kernel\MockHeaderSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of MockHeaderSubscriber

File

tests/src/Kernel/MockHeaderSubscriber.php, line 11

Namespace

Drupal\Tests\akamai\Kernel
View source
class MockHeaderSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[AkamaiHeaderEvents::HEADER_CREATION][] = [
      'onHeaderCreation',
    ];
    return $events;
  }

  /**
   * Add cache tags header on cacheable responses.
   *
   * @param \Drupal\akamai\Event\AkamaiHeaderEvents $event
   *   The event to process.
   */
  public function onHeaderCreation(AkamaiHeaderEvents $event) {
    $event->data[] = 'helloworld';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MockHeaderSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
MockHeaderSubscriber::onHeaderCreation public function Add cache tags header on cacheable responses.