Update to Drupal 8.2.0. For more information, see https://www.drupal.org/project/drupal/releases/8.2.0
This commit is contained in:
parent
2f563ab520
commit
f1c8716f57
1732 changed files with 52334 additions and 11780 deletions
41
core/modules/dblog/tests/src/Kernel/DbLogControllerTest.php
Normal file
41
core/modules/dblog/tests/src/Kernel/DbLogControllerTest.php
Normal file
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue