You are here

MockHeaderSubscriber.php in Akamai 8.3

File

tests/src/Kernel/MockHeaderSubscriber.php
View source
<?php

namespace Drupal\Tests\akamai\Kernel;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\akamai\Event\AkamaiHeaderEvents;

/**
 * Mock Event Subscriber for testing.
 */
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';
  }

}

Classes

Namesort descending Description
MockHeaderSubscriber Mock Event Subscriber for testing.