diff --git a/core/modules/system/src/Tests/Update/UpdateScriptTest.php b/core/modules/system/src/Tests/Update/UpdateScriptTest.php index b80ef82..f18f2e0 100644 --- a/core/modules/system/src/Tests/Update/UpdateScriptTest.php +++ b/core/modules/system/src/Tests/Update/UpdateScriptTest.php @@ -284,6 +284,28 @@ function testSuccessfulMultilingualUpdateFunctionality() { } /** + * Tests links on update.php + */ + protected function testUpdateLinks() { + $this->drupalLogin($this->updateUser); + $this->drupalGet($this->updateUrl, array('external' => TRUE)); + $this->assertResponse(200); + + // Check for the link to the maintenance mode setting page. + + /** @var \SimpleXMLElement[] $links */ + $links = $this->xpath('//a[normalize-space(text())=:label]', array(':label' => 'maintenance mode')); + $this->assertNotNull($links); + $href = (string) $links[0]['href']; + + // Adapted from @see http://stackoverflow.com/a/4444490 + $re = ['#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#']; + for ($n = 1; $n > 0; $href = preg_replace($re, '/', $href, -1, $n)) { } + $href = $this->getAbsoluteUrl($href); + $this->assertEqual($this->getAbsoluteUrl('admin/config/development/maintenance'), $href); + } + + /** * Helper function to run updates via the browser. */ protected function updateScriptTest($maintenance_mode) {