You are here

public function SubscriberTest::testOnKernelRequest in Excel Serialization 8

@covers ::onKernelRequest

File

tests/src/Unit/EventSubscriber/SubscriberTest.php, line 22

Class

SubscriberTest
Tests the XLS serialization event subscriber.

Namespace

Drupal\Tests\xls_serialization\Unit\EventSubscriber

Code

public function testOnKernelRequest() {

  // Both xls and xlsx should be set.
  $request = $this
    ->prophesize(Request::class);
  $request
    ->setFormat('xls', [
    'application/vnd.ms-excel',
  ])
    ->shouldBeCalled();
  $request
    ->setFormat('xlsx', [
    'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  ])
    ->shouldBeCalled();
  $event = $this
    ->prophesize(RequestEvent::class);
  $event
    ->getRequest()
    ->willReturn($request
    ->reveal());
  $subscriber = new Subscriber();
  $subscriber
    ->onKernelRequest($event
    ->reveal());
}