function RedirectEventSubscriberTest::testCheckRedirectIssued

Test the response is a redirect if a redirect url is added to the request.

@covers ::checkRedirectIssued

File

tests/src/Kernel/RedirectEventSubscriberTest.php, line 22

Class

RedirectEventSubscriberTest
Tests rules redirect action event subscriber.

Namespace

Drupal\Tests\rules\Kernel

Code

public function testCheckRedirectIssued() {
    
    /** @var \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel */
    $http_kernel = $this->container
        ->get('http_kernel');
    $request = Request::create('/');
    $request->attributes
        ->set('_rules_redirect_action_url', '/test/redirect/url');
    $response = $http_kernel->handle($request);
    $this->assertInstanceOf(RedirectResponse::class, $response, "The response is a redirect.");
    $this->assertEquals('/test/redirect/url', $response->getTargetUrl(), "The redirect target is the provided url.");
}