function ConfirmFormTest::testConfirmForm

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php \Drupal\Tests\system\Functional\Form\ConfirmFormTest::testConfirmForm()
  2. 8.9.x core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php \Drupal\Tests\system\Functional\Form\ConfirmFormTest::testConfirmForm()
  3. 10 core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php \Drupal\Tests\system\Functional\Form\ConfirmFormTest::testConfirmForm()
  4. 11.x 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.