updated core to 8.6.3

This commit is contained in:
2018-11-21 12:49:46 +01:00
parent 8ca34853a3
commit c92c348eee
521 changed files with 12199 additions and 4578 deletions
@@ -8,7 +8,6 @@ use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Url;
use Drupal\dblog\Controller\DbLogController;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\Traits\Core\CronRunTrait;
/**
* Generate events and verify dblog entries; verify user access to log reports
@@ -17,7 +16,6 @@ use Drupal\Tests\Traits\Core\CronRunTrait;
* @group dblog
*/
class DbLogTest extends BrowserTestBase {
use CronRunTrait;
use FakeLogEntries;
/**
@@ -67,7 +65,6 @@ class DbLogTest extends BrowserTestBase {
$row_limit = 100;
$this->verifyRowLimit($row_limit);
$this->verifyCron($row_limit);
$this->verifyEvents();
$this->verifyReports();
$this->verifyBreadcrumbs();
@@ -137,52 +134,6 @@ class DbLogTest extends BrowserTestBase {
$this->assertTrue($current_limit == $row_limit, format_string('[Cache] Row limit variable of @count equals row limit of @limit', ['@count' => $current_limit, '@limit' => $row_limit]));
}
/**
* Verifies that cron correctly applies the database log row limit.
*
* @param int $row_limit
* The row limit.
*/
private function verifyCron($row_limit) {
// Generate additional log entries.
$this->generateLogEntries($row_limit + 10);
// Verify that the database log row count exceeds the row limit.
$count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField();
$this->assertTrue($count > $row_limit, format_string('Dblog row count of @count exceeds row limit of @limit', ['@count' => $count, '@limit' => $row_limit]));
// Get the number of enabled modules. Cron adds a log entry for each module.
$list = \Drupal::moduleHandler()->getImplementations('cron');
$module_count = count($list);
$cron_detailed_count = $this->runCron();
$this->assertTrue($cron_detailed_count == $module_count + 2, format_string('Cron added @count of @expected new log entries', ['@count' => $cron_detailed_count, '@expected' => $module_count + 2]));
// Test disabling of detailed cron logging.
$this->config('system.cron')->set('logging', 0)->save();
$cron_count = $this->runCron();
$this->assertTrue($cron_count = 1, format_string('Cron added @count of @expected new log entries', ['@count' => $cron_count, '@expected' => 1]));
}
/**
* Runs cron and returns number of new log entries.
*
* @return int
* Number of new watchdog entries.
*/
private function runCron() {
// Get last ID to compare against; log entries get deleted, so we can't
// reliably add the number of newly created log entries to the current count
// to measure number of log entries created by cron.
$last_id = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
// Run a cron job.
$this->cronRun();
// Get last ID after cron was run.
$current_id = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
return $current_id - $last_id;
}
/**
* Clear the entry logs by clicking on 'Clear log messages' button.
*/
@@ -65,7 +65,7 @@ class DblogFiltersAndFieldsUpgradeTest extends UpdatePathTestBase {
// Now save the view. This trigger dblog_view_presave().
$view->save();
// Finally check the same convertion proccess ran.
// Finally check the same conversion process ran.
$data = $view->storage->toArray();
$fields = $data['display']['default']['display_options']['fields'];
$filters = $data['display']['default']['display_options']['filters'];
@@ -6,7 +6,7 @@ use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Views;
/**
* Test the upgrade path of changing the emtpy text area for watchdog view.
* Test the upgrade path of changing the empty text area for watchdog view.
*
* @see dblog_update_8600()
*
@@ -5,7 +5,7 @@ namespace Drupal\Tests\dblog\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Ensures that update hook that creates the watchdog view ran sucessfully.
* Ensures that update hook that creates the watchdog view ran successfully.
*
* @group Update
* @group legacy
@@ -25,7 +25,7 @@ class DblogRecentLogsUsingViewsUpdateTest extends UpdatePathTestBase {
* Ensures that update hook is run for dblog module.
*/
public function testUpdate() {
// Make sure the watchog view doesn't exist before the updates.
// Make sure the watchdog view doesn't exist before the updates.
$view = \Drupal::entityTypeManager()->getStorage('view')->load('watchdog');
$this->assertNull($view);
@@ -0,0 +1,77 @@
<?php
namespace Drupal\Tests\dblog\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\dblog\Functional\FakeLogEntries;
/**
* Generate events and verify dblog entries.
*
* @group dblog
*/
class DbLogTest extends KernelTestBase {
use FakeLogEntries;
/**
* {@inheritdoc}
*/
protected static $modules = ['dblog', 'system'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installSchema('dblog', ['watchdog']);
$this->installSchema('system', ['key_value_expire', 'sequences']);
$this->installConfig(['system']);
}
/**
* Tests that cron correctly applies the database log row limit.
*/
public function testDbLogCron() {
$row_limit = 100;
// Generate additional log entries.
$this->generateLogEntries($row_limit + 10);
// Verify that the database log row count exceeds the row limit.
$count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField();
$this->assertGreaterThan($row_limit, $count, format_string('Dblog row count of @count exceeds row limit of @limit', ['@count' => $count, '@limit' => $row_limit]));
// Get the number of enabled modules. Cron adds a log entry for each module.
$list = $this->container->get('module_handler')->getImplementations('cron');
$module_count = count($list);
$cron_detailed_count = $this->runCron();
$this->assertEquals($module_count + 2, $cron_detailed_count, format_string('Cron added @count of @expected new log entries', ['@count' => $cron_detailed_count, '@expected' => $module_count + 2]));
// Test disabling of detailed cron logging.
$this->config('system.cron')->set('logging', 0)->save();
$cron_count = $this->runCron();
$this->assertEquals(1, $cron_count, format_string('Cron added @count of @expected new log entries', ['@count' => $cron_count, '@expected' => 1]));
}
/**
* Runs cron and returns number of new log entries.
*
* @return int
* Number of new watchdog entries.
*/
private function runCron() {
// Get last ID to compare against; log entries get deleted, so we can't
// reliably add the number of newly created log entries to the current count
// to measure number of log entries created by cron.
$last_id = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
// Run a cron job.
$this->container->get('cron')->run();
// Get last ID after cron was run.
$current_id = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
return $current_id - $last_id;
}
}