class CsrfExceptionSubscriberTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/EventSubscriber/CsrfExceptionSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\CsrfExceptionSubscriberTest
Tests Drupal\Core\EventSubscriber\CsrfExceptionSubscriber.
Attributes
#[CoversClass(CsrfExceptionSubscriber::class)]
#[Group('EventSubscriber')]
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\DrupalTestCaseTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\Tests\RandomGeneratorTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\EventSubscriber\CsrfExceptionSubscriberTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of CsrfExceptionSubscriberTest
File
-
core/
tests/ Drupal/ Tests/ Core/ EventSubscriber/ CsrfExceptionSubscriberTest.php, line 19
Namespace
Drupal\Tests\Core\EventSubscriberView source
class CsrfExceptionSubscriberTest extends UnitTestCase {
/**
* Tests on403() with no matched route.
*/
public function testOn403WithNullRouteDoesNothing() : void {
$subscriber = new CsrfExceptionSubscriber();
$request = new Request();
$kernel = $this->createStub(HttpKernelInterface::class);
$exception = new AccessDeniedHttpException();
$event = new ExceptionEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST, $exception);
$subscriber->on403($event);
$this->assertNull($event->getResponse());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.