You are here

protected function PsrResponseSubscriberTest::createEventMock in Drupal 8

Sets up an alias event that return $controllerResult.

Parameters

mixed $controller_result: The return Object.

Return value

\Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent|\PHPUnit\Framework\MockObject\MockObject A mock object to test.

2 calls to PsrResponseSubscriberTest::createEventMock()
PsrResponseSubscriberTest::testConvertsControllerResult in core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php
Tests altering and finished event.
PsrResponseSubscriberTest::testDoesNotConvertControllerResult in core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php
Tests altering and finished event.

File

core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php, line 86

Class

PsrResponseSubscriberTest
@coversDefaultClass \Drupal\Core\EventSubscriber\PsrResponseSubscriber @group EventSubscriber

Namespace

Drupal\Tests\Core\EventSubscriber

Code

protected function createEventMock($controller_result) {
  $event = $this
    ->getMockBuilder('Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent')
    ->disableOriginalConstructor()
    ->getMock();
  $event
    ->expects($this
    ->once())
    ->method('getControllerResult')
    ->willReturn($controller_result);
  return $event;
}