Update to Drupal 8.1.2. For more information, see https://www.drupal.org/project/drupal/releases/8.1.2

This commit is contained in:
Pantheon Automation 2016-06-02 15:56:09 -07:00 committed by Greg Anderson
parent 9eae24d844
commit 28556d630e
1322 changed files with 6699 additions and 2064 deletions

View file

@ -40,7 +40,7 @@ class TestHttpClientMiddleware {
// Call \Drupal\simpletest\WebTestBase::error() with the parameters from
// the header.
$parameters = unserialize(urldecode($header_value));
if (count($parameters) === 3) {
if (count($parameters) === 3) {
throw new \Exception($parameters[1] . ': ' . $parameters[0] . "\n" . Error::formatBacktrace([$parameters[2]]));
}
else {

View file

@ -0,0 +1,44 @@
<?php
namespace Drupal\Core\Test;
use Drupal\Core\Database\ConnectionNotDefinedException;
use Drupal\Core\Database\Database;
/**
* Provides helper methods for interacting with the Simpletest database.
*/
class TestDatabase {
/**
* Returns the database connection to the site running Simpletest.
*
* @return \Drupal\Core\Database\Connection
* The database connection to use for inserting assertions.
*
* @see \Drupal\simpletest\TestBase::prepareEnvironment()
*/
public static function getConnection() {
// Check whether there is a test runner connection.
// @see run-tests.sh
// @todo Convert Simpletest UI runner to create + use this connection, too.
try {
$connection = Database::getConnection('default', 'test-runner');
}
catch (ConnectionNotDefinedException $e) {
// Check whether there is a backup of the original default connection.
// @see TestBase::prepareEnvironment()
try {
$connection = Database::getConnection('default', 'simpletest_original_default');
}
catch (ConnectionNotDefinedException $e) {
// If TestBase::prepareEnvironment() or TestBase::restoreEnvironment()
// failed, the test-specific database connection does not exist
// yet/anymore, so fall back to the default of the (UI) test runner.
$connection = Database::getConnection('default', 'default');
}
}
return $connection;
}
}