public function ConfirmFormTest::testConfirmFormWithExternalDestination in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Form/ConfirmFormTest.php \Drupal\system\Tests\Form\ConfirmFormTest::testConfirmFormWithExternalDestination()
Tests that the confirm form does not use external destinations.
File
- core/
modules/ system/ src/ Tests/ Form/ ConfirmFormTest.php, line 58 - Contains \Drupal\system\Tests\Form\ConfirmFormTest.
Class
- ConfirmFormTest
- Tests confirmation forms.
Namespace
Drupal\system\Tests\FormCode
public function testConfirmFormWithExternalDestination() {
$this
->drupalGet('form-test/confirm-form');
$this
->assertCancelLinkUrl(Url::fromRoute('form_test.route8'));
$this
->drupalGet('form-test/confirm-form', array(
'query' => array(
'destination' => 'node',
),
));
$this
->assertCancelLinkUrl(Url::fromUri('internal:/node'));
$this
->drupalGet('form-test/confirm-form', array(
'query' => array(
'destination' => 'http://example.com',
),
));
$this
->assertCancelLinkUrl(Url::fromRoute('form_test.route8'));
$this
->drupalGet('form-test/confirm-form', array(
'query' => array(
'destination' => '<front>',
),
));
$this
->assertCancelLinkUrl(Url::fromRoute('<front>'));
// Other invalid destinations, should fall back to the form default.
$this
->drupalGet('form-test/confirm-form', array(
'query' => array(
'destination' => '/http://example.com',
),
));
$this
->assertCancelLinkUrl(Url::fromRoute('form_test.route8'));
}