function 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 86
Class
- PsrResponseSubscriberTest
- @coversDefaultClass \Drupal\Core\EventSubscriber\PsrResponseSubscriber @group EventSubscriber
Namespace
Drupal\Tests\Core\EventSubscriberCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.