Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Controller\DbLogController.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Controller;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Form\DblogClearLogConfirmForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Form;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Form\DblogClearLogForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Form;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Form\DblogFilterForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Logger\DbLog.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Logger;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Plugin\rest\resource\DBLogResource.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Plugin\rest\resource;
|
||||
|
||||
use Drupal\rest\Plugin\ResourceBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Plugin\views\field\DblogMessage.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Plugin\views\field;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Plugin\views\field\DblogOperations.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Plugin\views\field;
|
||||
|
||||
use Drupal\views\Plugin\views\field\FieldPluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Plugin\views\wizard\Watchdog.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Plugin\views\wizard;
|
||||
|
||||
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Tests\ConnectionFailureTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Tests;
|
||||
|
||||
use Drupal\Core\Database\Database;
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Tests\DbLogFormInjectionTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Tests;
|
||||
|
||||
|
||||
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
|
||||
use Drupal\Core\Form\FormInterface;
|
||||
use Drupal\Core\Form\FormState;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\user\Entity\User;
|
||||
|
||||
/**
|
||||
* Tests serializing a form with an injected dblog logger instance.
|
||||
*
|
||||
* @group dblog
|
||||
*/
|
||||
class DbLogFormInjectionTest extends KernelTestBase implements FormInterface {
|
||||
|
||||
use DependencySerializationTrait;
|
||||
|
||||
/**
|
||||
* A Dblog logger instance.
|
||||
*
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('system', 'dblog', 'user');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId() {
|
||||
return 'dblog_test_injection_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Process callback.
|
||||
*
|
||||
* @param array $element
|
||||
* Form element
|
||||
*
|
||||
* @return array
|
||||
* Processed element.
|
||||
*/
|
||||
public function process($element) {
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$form['#process'][] = [$this, 'process'];
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateForm(array &$form, FormStateInterface $form_state) {}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
$form_state->setRebuild();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installSchema('dblog', ['watchdog']);
|
||||
$this->installSchema('system', ['key_value_expire', 'sequences']);
|
||||
$this->installEntitySchema('user');
|
||||
$this->logger = \Drupal::logger('test_logger');
|
||||
$test_user = User::create(array(
|
||||
'name' => 'foobar',
|
||||
'mail' => 'foobar@example.com',
|
||||
));
|
||||
$test_user->save();
|
||||
\Drupal::service('current_user')->setAccount($test_user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests db log injection serialization.
|
||||
*/
|
||||
public function testLoggerSerialization() {
|
||||
$form_state = new FormState();
|
||||
|
||||
// Forms are only serialized during POST requests.
|
||||
$form_state->setRequestMethod('POST');
|
||||
$form_state->setCached();
|
||||
$form_builder = $this->container->get('form_builder');
|
||||
$form_id = $form_builder->getFormId($this, $form_state);
|
||||
$form = $form_builder->retrieveForm($form_id, $form_state);
|
||||
$form_builder->prepareForm($form_id, $form, $form_state);
|
||||
$form_builder->processForm($form_id, $form, $form_state);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Tests\DbLogTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Tests;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Tests\Migrate\d6\MigrateDblogConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to dblog.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateDblogConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['dblog'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->executeMigration('d6_dblog_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of dblog variables to dblog.settings.yml.
|
||||
*/
|
||||
public function testBookSettings() {
|
||||
$config = $this->config('dblog.settings');
|
||||
$this->assertIdentical(10000, $config->get('row_limit'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'dblog.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Tests\Migrate\d7\MigrateDblogConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Tests\Migrate\d7;
|
||||
|
||||
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to dblog.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal_7
|
||||
*/
|
||||
class MigrateDblogConfigsTest extends MigrateDrupal7TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['dblog'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(static::$modules);
|
||||
$this->executeMigration('d7_dblog_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of dblog variables to dblog.settings.yml.
|
||||
*/
|
||||
public function testDblogSettings() {
|
||||
$config = $this->config('dblog.settings');
|
||||
$this->assertIdentical(10000, $config->get('row_limit'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Tests\Rest\DbLogResourceTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Tests\Rest;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dblog\Tests\Views\ViewsIntegrationTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\dblog\Tests\Views;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Drupal\Core\Logger\RfcLogLevel;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\views\Views;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
use Drupal\views\Tests\ViewKernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests the views integration of dblog module.
|
||||
*
|
||||
* @group dblog
|
||||
*/
|
||||
class ViewsIntegrationTest extends ViewKernelTestBase {
|
||||
|
||||
/**
|
||||
* Views used by this test.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = array('test_dblog');
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('dblog', 'dblog_test_views', 'user');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Rebuild the router, otherwise we can't generate links.
|
||||
$this->container->get('router.builder')->rebuild();
|
||||
|
||||
$this->installSchema('dblog', array('watchdog'));
|
||||
|
||||
ViewTestData::createTestViews(get_class($this), array('dblog_test_views'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the integration.
|
||||
*/
|
||||
public function testIntegration() {
|
||||
|
||||
// Remove the watchdog entries added by the potential batch process.
|
||||
$this->container->get('database')->truncate('watchdog')->execute();
|
||||
|
||||
$entries = array();
|
||||
// Setup a watchdog entry without tokens.
|
||||
$entries[] = array(
|
||||
'message' => $this->randomMachineName(),
|
||||
'variables' => array('link' => \Drupal::l('Link', new Url('<front>'))),
|
||||
);
|
||||
// Setup a watchdog entry with one token.
|
||||
$entries[] = array(
|
||||
'message' => '@token1',
|
||||
'variables' => array('@token1' => $this->randomMachineName(), 'link' => \Drupal::l('Link', new Url('<front>'))),
|
||||
);
|
||||
// Setup a watchdog entry with two tokens.
|
||||
$entries[] = array(
|
||||
'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(
|
||||
'@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(
|
||||
'type' => 'test-views',
|
||||
'severity' => RfcLogLevel::NOTICE,
|
||||
);
|
||||
$logger_factory->get($entry['type'])->log($entry['severity'], $entry['message'], $entry['variables']);
|
||||
}
|
||||
|
||||
$view = Views::getView('test_dblog');
|
||||
$this->executeView($view);
|
||||
$view->initStyle();
|
||||
|
||||
foreach ($entries as $index => $entry) {
|
||||
$this->assertEqual($view->style_plugin->getField($index, 'message'), SafeMarkup::format($entry['message'], $entry['variables']));
|
||||
$link_field = $view->style_plugin->getField($index, 'link');
|
||||
// The 3rd entry contains some unsafe markup that needs to get filtered.
|
||||
if ($index == 2) {
|
||||
// Make sure that unsafe link differs from the rendered link, so we know
|
||||
// that some filtering actually happened.
|
||||
$this->assertNotEqual($link_field, $entry['variables']['link']);
|
||||
}
|
||||
$this->assertEqual($link_field, Xss::filterAdmin($entry['variables']['link']));
|
||||
}
|
||||
|
||||
// Disable replacing variables and check that the tokens aren't replaced.
|
||||
$view->destroy();
|
||||
$view->storage->invalidateCaches();
|
||||
$view->initHandlers();
|
||||
$this->executeView($view);
|
||||
$view->initStyle();
|
||||
$view->field['message']->options['replace_variables'] = FALSE;
|
||||
foreach ($entries as $index => $entry) {
|
||||
$this->assertEqual($view->style_plugin->getField($index, 'message'), $entry['message']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue