summaryrefslogtreecommitdiff
path: root/modules/system/system.test
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-03-18 15:23:16 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-03-18 15:23:16 -0400
commitc4164898def11c956348750c9b41fdbb06ddb069 (patch)
treea04720f5b76742f87c36ff51bff40afb5844b68d /modules/system/system.test
parentea85d7c8e6f1793357841d0ba8d64f01cd3f69f4 (diff)
parentb44056d2f8e8c71d35c85ec5c2fb8f7c8a02d8a8 (diff)
downloadbrdo-c4164898def11c956348750c9b41fdbb06ddb069.tar.gz
brdo-c4164898def11c956348750c9b41fdbb06ddb069.tar.bz2
Merge tag '7.35' into 7.x
7.35 release Conflicts: CHANGELOG.txt includes/bootstrap.inc
Diffstat (limited to 'modules/system/system.test')
-rw-r--r--modules/system/system.test43
1 files changed, 43 insertions, 0 deletions
diff --git a/modules/system/system.test b/modules/system/system.test
index aefbfbc46..dcc86e539 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -2825,3 +2825,46 @@ class SystemValidTokenTest extends DrupalUnitTestCase {
return TRUE;
}
}
+
+/**
+ * Tests confirm form destinations.
+ */
+class ConfirmFormTest extends DrupalWebTestCase {
+ protected $admin_user;
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Confirm form',
+ 'description' => 'Tests that the confirm form does not use external destinations.',
+ 'group' => 'System',
+ );
+ }
+
+ function setUp() {
+ parent::setUp();
+
+ $this->admin_user = $this->drupalCreateUser(array('administer users'));
+ $this->drupalLogin($this->admin_user);
+ }
+
+ /**
+ * Tests that the confirm form does not use external destinations.
+ */
+ 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'));
+ }
+
+ /**
+ * Asserts that a cancel link is present pointing to the provided URL.
+ */
+ function assertCancelLinkUrl($url, $message = '', $group = 'Other') {
+ $links = $this->xpath('//a[normalize-space(text())=:label and @href=:url]', array(':label' => t('Cancel'), ':url' => $url));
+ $message = ($message ? $message : format_string('Cancel link with url %url found.', array('%url' => $url)));
+ return $this->assertTrue(isset($links[0]), $message, $group);
+ }
+}