You are here

protected function PsrResponseSubscriberTest::createEventMock in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/EventSubscriber/PsrResponseSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\PsrResponseSubscriberTest::createEventMock()

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 90
Contains \Drupal\Tests\Core\EventSubscriber\PsrResponseSubscriberTest.

Class

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

Namespace

Drupal\Tests\Core\EventSubscriber

Code

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