Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\dblog\Functional;
|
||||
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
/**
|
||||
* Tests logging of connection failures.
|
||||
*
|
||||
* @group dblog
|
||||
*/
|
||||
class ConnectionFailureTest extends BrowserTestBase {
|
||||
|
||||
public static $modules = ['dblog'];
|
||||
|
||||
/**
|
||||
* Tests logging of connection failures.
|
||||
*/
|
||||
public function testConnectionFailureLogging() {
|
||||
$logger = \Drupal::service('logger.factory');
|
||||
|
||||
// MySQL errors like "1153 - Got a packet bigger than 'max_allowed_packet'
|
||||
// bytes" or "1100 - Table 'xyz' was not locked with LOCK TABLES" lead to a
|
||||
// database connection unusable for further requests. All further request
|
||||
// will result in an "2006 - MySQL server had gone away" error. As a
|
||||
// consequence it's impossible to use this connection to log the causing
|
||||
// initial error itself. Using Database::closeConnection() we simulate such
|
||||
// a corrupted connection. In this case dblog has to establish a different
|
||||
// connection by itself to be able to write the log entry.
|
||||
Database::closeConnection();
|
||||
|
||||
// Create a log entry.
|
||||
$logger->get('php')->error('testConnectionFailureLogging');
|
||||
|
||||
// Re-establish the default database connection.
|
||||
Database::getConnection();
|
||||
|
||||
$wid = db_query("SELECT MAX(wid) FROM {watchdog} WHERE message = 'testConnectionFailureLogging'")->fetchField();
|
||||
$this->assertTrue($wid, 'Watchdog entry has been stored in database.');
|
||||
}
|
||||
|
||||
}
|
|
@ -31,7 +31,7 @@ class DbLogFormInjectionTest extends KernelTestBase implements FormInterface {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('system', 'dblog', 'user');
|
||||
public static $modules = ['system', 'dblog', 'user'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -82,10 +82,10 @@ class DbLogFormInjectionTest extends KernelTestBase implements FormInterface {
|
|||
$this->installSchema('system', ['key_value_expire', 'sequences']);
|
||||
$this->installEntitySchema('user');
|
||||
$this->logger = \Drupal::logger('test_logger');
|
||||
$test_user = User::create(array(
|
||||
$test_user = User::create([
|
||||
'name' => 'foobar',
|
||||
'mail' => 'foobar@example.com',
|
||||
));
|
||||
]);
|
||||
$test_user->save();
|
||||
\Drupal::service('current_user')->setAccount($test_user);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Drupal\Tests\dblog\Kernel\Migrate\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,14 +22,14 @@ class ViewsIntegrationTest extends ViewsKernelTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = array('test_dblog');
|
||||
public static $testViews = ['test_dblog'];
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('dblog', 'dblog_test_views', 'user');
|
||||
public static $modules = ['dblog', 'dblog_test_views', 'user'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -40,9 +40,9 @@ class ViewsIntegrationTest extends ViewsKernelTestBase {
|
|||
// Rebuild the router, otherwise we can't generate links.
|
||||
$this->container->get('router.builder')->rebuild();
|
||||
|
||||
$this->installSchema('dblog', array('watchdog'));
|
||||
$this->installSchema('dblog', ['watchdog']);
|
||||
|
||||
ViewTestData::createTestViews(get_class($this), array('dblog_test_views'));
|
||||
ViewTestData::createTestViews(get_class($this), ['dblog_test_views']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,35 +53,35 @@ class ViewsIntegrationTest extends ViewsKernelTestBase {
|
|||
// Remove the watchdog entries added by the potential batch process.
|
||||
$this->container->get('database')->truncate('watchdog')->execute();
|
||||
|
||||
$entries = array();
|
||||
$entries = [];
|
||||
// Setup a watchdog entry without tokens.
|
||||
$entries[] = array(
|
||||
$entries[] = [
|
||||
'message' => $this->randomMachineName(),
|
||||
'variables' => array('link' => \Drupal::l('Link', new Url('<front>'))),
|
||||
);
|
||||
'variables' => ['link' => \Drupal::l('Link', new Url('<front>'))],
|
||||
];
|
||||
// Setup a watchdog entry with one token.
|
||||
$entries[] = array(
|
||||
$entries[] = [
|
||||
'message' => '@token1',
|
||||
'variables' => array('@token1' => $this->randomMachineName(), 'link' => \Drupal::l('Link', new Url('<front>'))),
|
||||
);
|
||||
'variables' => ['@token1' => $this->randomMachineName(), 'link' => \Drupal::l('Link', new Url('<front>'))],
|
||||
];
|
||||
// Setup a watchdog entry with two tokens.
|
||||
$entries[] = array(
|
||||
$entries[] = [
|
||||
'message' => '@token1 @token2',
|
||||
// Setup a link with a tag which is filtered by
|
||||
// \Drupal\Component\Utility\Xss::filterAdmin() in order to make sure
|
||||
// that strings which are not marked as safe get filtered.
|
||||
'variables' => array(
|
||||
'variables' => [
|
||||
'@token1' => $this->randomMachineName(),
|
||||
'@token2' => $this->randomMachineName(),
|
||||
'link' => '<a href="' . \Drupal::url('<front>') . '"><object>Link</object></a>',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
$logger_factory = $this->container->get('logger.factory');
|
||||
foreach ($entries as $entry) {
|
||||
$entry += array(
|
||||
$entry += [
|
||||
'type' => 'test-views',
|
||||
'severity' => RfcLogLevel::NOTICE,
|
||||
);
|
||||
];
|
||||
$logger_factory->get($entry['type'])->log($entry['severity'], $entry['message'], $entry['variables']);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue