public function RequestSanitizerTest::testAcceptableDestinationGet in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php \Drupal\Tests\Core\Security\RequestSanitizerTest::testAcceptableDestinationGet()
- 9 core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php \Drupal\Tests\Core\Security\RequestSanitizerTest::testAcceptableDestinationGet()
Tests acceptable destinations are not removed from GET requests.
@dataProvider providerTestAcceptableDestinations
Parameters
string $destination: The destination string to test.
File
- core/
tests/ Drupal/ Tests/ Core/ Security/ RequestSanitizerTest.php, line 208
Class
- RequestSanitizerTest
- Tests RequestSanitizer class.
Namespace
Drupal\Tests\Core\SecurityCode
public function testAcceptableDestinationGet($destination) {
// Set up a GET request.
$request = $this
->createRequestForTesting([
'destination' => $destination,
]);
$request = RequestSanitizer::sanitize($request, [], TRUE);
$this
->assertSame($destination, $request->query
->get('destination', NULL));
$this
->assertNull($request->request
->get('destination', NULL));
$this
->assertSame($destination, $_GET['destination']);
$this
->assertSame($destination, $_REQUEST['destination']);
$this
->assertArrayNotHasKey('destination', $_POST);
$this
->assertEquals([], $this->errors);
}