public function ManageFieldsFunctionalTest::testExternalDestinations in Drupal 8
Same name and namespace in other branches
- 9 core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::testExternalDestinations()
- 10 core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::testExternalDestinations()
Tests that external URLs in the 'destinations' query parameter are blocked.
File
- core/
modules/ field_ui/ tests/ src/ Functional/ ManageFieldsFunctionalTest.php, line 727
Class
- ManageFieldsFunctionalTest
- Tests the Field UI "Manage fields" screen.
Namespace
Drupal\Tests\field_ui\FunctionalCode
public function testExternalDestinations() {
$options = [
'query' => [
'destinations' => [
'http://example.com',
],
],
];
$this
->drupalPostForm('admin/structure/types/manage/article/fields/node.article.body/storage', [], 'Save field settings', $options);
// The external redirect should not fire.
$this
->assertUrl('admin/structure/types/manage/article/fields/node.article.body/storage', $options);
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertRaw('Attempt to update field <em class="placeholder">Body</em> failed: <em class="placeholder">The internal path component 'http://example.com' is external. You are not allowed to specify an external URL together with internal:/.</em>.');
}