Core and composer updates
This commit is contained in:
parent
a82634bb98
commit
62cac30480
1118 changed files with 21770 additions and 6306 deletions
|
@ -246,6 +246,20 @@ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase {
|
|||
*/
|
||||
protected $originalShutdownCallbacks = [];
|
||||
|
||||
/**
|
||||
* The number of meta refresh redirects to follow, or NULL if unlimited.
|
||||
*
|
||||
* @var null|int
|
||||
*/
|
||||
protected $maximumMetaRefreshCount = NULL;
|
||||
|
||||
/**
|
||||
* The number of meta refresh redirects followed during ::drupalGet().
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $metaRefreshCount = 0;
|
||||
|
||||
/**
|
||||
* Initializes Mink sessions.
|
||||
*/
|
||||
|
@ -637,6 +651,13 @@ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase {
|
|||
// Ensure that any changes to variables in the other thread are picked up.
|
||||
$this->refreshVariables();
|
||||
|
||||
// Replace original page output with new output from redirected page(s).
|
||||
if ($new = $this->checkForMetaRefresh()) {
|
||||
$out = $new;
|
||||
// We are finished with all meta refresh redirects, so reset the counter.
|
||||
$this->metaRefreshCount = 0;
|
||||
}
|
||||
|
||||
// Log only for JavascriptTestBase tests because for Goutte we log with
|
||||
// ::getResponseLogHandler.
|
||||
if ($this->htmlOutputEnabled && !($this->getSession()->getDriver() instanceof GoutteDriver)) {
|
||||
|
@ -810,6 +831,12 @@ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase {
|
|||
// Ensure that any changes to variables in the other thread are picked up.
|
||||
$this->refreshVariables();
|
||||
|
||||
// Check if there are any meta refresh redirects (like Batch API pages).
|
||||
if ($this->checkForMetaRefresh()) {
|
||||
// We are finished with all meta refresh redirects, so reset the counter.
|
||||
$this->metaRefreshCount = 0;
|
||||
}
|
||||
|
||||
// Log only for JavascriptTestBase tests because for Goutte we log with
|
||||
// ::getResponseLogHandler.
|
||||
if ($this->htmlOutputEnabled && !($this->getSession()->getDriver() instanceof GoutteDriver)) {
|
||||
|
@ -1369,4 +1396,26 @@ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase {
|
|||
return $caller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for meta refresh tag and if found call drupalGet() recursively.
|
||||
*
|
||||
* This function looks for the http-equiv attribute to be set to "Refresh" and
|
||||
* is case-sensitive.
|
||||
*
|
||||
* @return string|false
|
||||
* Either the new page content or FALSE.
|
||||
*/
|
||||
protected function checkForMetaRefresh() {
|
||||
$refresh = $this->cssSelect('meta[http-equiv="Refresh"]');
|
||||
if (!empty($refresh) && (!isset($this->maximumMetaRefreshCount) || $this->metaRefreshCount < $this->maximumMetaRefreshCount)) {
|
||||
// Parse the content attribute of the meta tag for the format:
|
||||
// "[delay]: URL=[page_to_redirect_to]".
|
||||
if (preg_match('/\d+;\s*URL=(?<url>.*)/i', $refresh[0]->getAttribute('content'), $match)) {
|
||||
$this->metaRefreshCount++;
|
||||
return $this->drupalGet($this->getAbsoluteUrl(Html::decodeEntities($match['url'])));
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue