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:
parent
9eae24d844
commit
28556d630e
1322 changed files with 6699 additions and 2064 deletions
|
@ -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 {
|
||||
|
|
44
core/lib/Drupal/Core/Test/TestDatabase.php
Normal file
44
core/lib/Drupal/Core/Test/TestDatabase.php
Normal 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;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue