RedirectEventSubscriberTest.php in Rules 8.3
File
tests/src/Kernel/RedirectEventSubscriberTest.php
View source
<?php
namespace Drupal\Tests\rules\Kernel;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
class RedirectEventSubscriberTest extends RulesKernelTestBase {
public function testCheckRedirectIssued() {
$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.");
}
}