updated core and modules

This commit is contained in:
Bachir Soussi Chiadmi
2017-09-09 16:27:51 +02:00
parent 027aa99b32
commit 41863f872c
7810 changed files with 318922 additions and 83631 deletions
@@ -8,8 +8,8 @@ dependencies:
- dblog
- views
# Information added by Drupal.org packaging script on 2016-08-03
version: '8.1.8'
# Information added by Drupal.org packaging script on 2017-08-16
version: '8.3.7'
core: '8.x'
project: 'drupal'
datestamp: 1470233790
datestamp: 1502903957
@@ -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.');
}
}
@@ -0,0 +1,41 @@
<?php
namespace Drupal\Tests\dblog\Kernel;
use Drupal\dblog\Controller\DbLogController;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests for the DbLogController class.
*
* @group dblog
*/
class DbLogControllerTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['dblog', 'user'];
/**
* Tests corrupted log entries can still display available data.
*/
public function testDbLogCorrupted() {
$this->installEntitySchema('user');
$dblog_controller = DbLogController::create($this->container);
// Check message with properly serialized data.
$message = (object) [
'message' => 'Sample message with placeholder: @placeholder',
'variables' => serialize(['@placeholder' => 'test placeholder']),
];
$this->assertEquals('Sample message with placeholder: test placeholder', $dblog_controller->formatMessage($message));
// Check that controller work with corrupted data.
$message->variables = 'BAD SERIALIZED DATA';
$formatted = $dblog_controller->formatMessage($message);
$this->assertEquals('Log data is corrupted and cannot be unserialized: Sample message with placeholder: @placeholder', $formatted);
}
}
@@ -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']);
}