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