Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542

This commit is contained in:
Pantheon Automation 2015-08-27 12:03:05 -07:00 committed by Greg Anderson
parent 3b2511d96d
commit 81ccda77eb
2155 changed files with 54307 additions and 46870 deletions

View file

@ -1,42 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\Core\Test\EventSubscriber\HttpRequestSubscriber.
*/
namespace Drupal\Core\Test\EventSubscriber;
use GuzzleHttp\Event\BeforeEvent;
use GuzzleHttp\Event\SubscriberInterface;
/**
* Overrides the User-Agent HTTP header for outbound HTTP requests.
*/
class HttpRequestSubscriber implements SubscriberInterface {
/**
* {@inheritdoc}
*/
public function getEvents() {
return array(
'before' => array('onBeforeSendRequest'),
);
}
/**
* Event callback for the 'before' event
*/
public function onBeforeSendRequest(BeforeEvent $event) {
// If the database prefix is being used by SimpleTest to run the tests in a copied
// database then set the user-agent header to the database prefix so that any
// calls to other Drupal pages will run the SimpleTest prefixed database. The
// user-agent is used to ensure that multiple testing sessions running at the
// same time won't interfere with each other as they would if the database
// prefix were stored statically in a file or database variable.
if ($test_prefix = drupal_valid_test_ua()) {
$event->getRequest()->setHeader('User-Agent', drupal_generate_test_ua($test_prefix));
}
}
}

View file

@ -0,0 +1,39 @@
<?php
/**
* @file
* Contains \Drupal\Core\Test\HttpClientMiddleware\TestHttpClientMiddleware.
*/
namespace Drupal\Core\Test\HttpClientMiddleware;
use Psr\Http\Message\RequestInterface;
/**
* Overrides the User-Agent HTTP header for outbound HTTP requests.
*/
class TestHttpClientMiddleware {
/**
* {@inheritdoc}
*
* HTTP middleware that replaces the user agent for simpletest requests.
*/
public function __invoke() {
// If the database prefix is being used by SimpleTest to run the tests in a copied
// database then set the user-agent header to the database prefix so that any
// calls to other Drupal pages will run the SimpleTest prefixed database. The
// user-agent is used to ensure that multiple testing sessions running at the
// same time won't interfere with each other as they would if the database
// prefix were stored statically in a file or database variable.
return function ($handler) {
return function (RequestInterface $request, array $options) use ($handler) {
if ($test_prefix = drupal_valid_test_ua()) {
$request = $request->withHeader('User-Agent', drupal_generate_test_ua($test_prefix));
}
return $handler($request, $options);
};
};
}
}