function ConfirmFormTest::testConfirmForm

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php \Drupal\Tests\system\Functional\Form\ConfirmFormTest::testConfirmForm()
  2. 9 core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php \Drupal\Tests\system\Functional\Form\ConfirmFormTest::testConfirmForm()

Tests that the confirm form does not use external destinations.

File

modules/system/system.test, line 3171

Class

ConfirmFormTest
Tests confirm form destinations.

Code

function testConfirmForm() {
  $this->drupalGet('user/1/cancel');
  $this->assertCancelLinkUrl(url('user/1'));
  $this->drupalGet('user/1/cancel', array(
    'query' => array(
      'destination' => 'node',
    ),
  ));
  $this->assertCancelLinkUrl(url('node'));
  $this->drupalGet('user/1/cancel', array(
    'query' => array(
      'destination' => 'http://example.com',
    ),
  ));
  $this->assertCancelLinkUrl(url('user/1'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.