Commit 4998114f authored by Jacob Friis Mathiasen's avatar Jacob Friis Mathiasen
Browse files

Issue #3309387: cleanup and changelog.

parent d90a2cf0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@ using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
### Changed

### Fixed
- Formattable strings are not supported
  (issue [\#3309387](https://www.drupal.org/project/jsonlog/issues/3309387)).


## [3.0.0] - 2021-08-22
+1 −1
Original line number Diff line number Diff line
@@ -3,9 +3,9 @@
namespace Drupal\jsonlog\Logger;

use Drupal\Component\Serialization\Json;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\StringTranslation\TranslatableMarkup;

class JsonLogData {
+7 −7
Original line number Diff line number Diff line
@@ -2,10 +2,10 @@

namespace Drupal\Tests\jsonlog\Unit;

use Drupal\Tests\UnitTestCase;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\jsonlog\Logger\JsonLogData;
use Drupal\Tests\UnitTestCase;
use Drupal\Tests\jsonlog\MockTranslation;

/**
@@ -86,23 +86,23 @@ class JsonLogDataTest extends UnitTestCase {
    $this->assertEmpty($this->data->getTrunc(), 'Message not truncated');
  }

  public function testCanSetFormattableMessage() {
  public function testCanSetTranslatableMessage() {
    $this->data = new JsonLogData('test_site_id', 'test_canonical');
    $this->assertNull($this->data->getMessage(), 'Message empty by default');

    $msg = new FormattableMarkup('formattable logging item', []);
    $msg = new TranslatableMarkup('translatable logging item', [], [], new MockTranslation());
    $this->data->setMessage($msg);
    $this->assertEquals('formattable logging item', $this->data->getMessage(), 'By default message gets logged.');
    $this->assertEquals('translatable logging item', $this->data->getMessage(), 'By default message gets logged.');
    $this->assertEmpty($this->data->getTrunc(), 'Message not truncated');
  }

  public function testCanSetTranslatableMessage() {
  public function testCanSetFormattableMessage() {
    $this->data = new JsonLogData('test_site_id', 'test_canonical');
    $this->assertNull($this->data->getMessage(), 'Message empty by default');

    $msg = new TranslatableMarkup('translatable logging item', [], [], new MockTranslation());
    $msg = new FormattableMarkup('formattable logging item', []);
    $this->data->setMessage($msg);
    $this->assertEquals('translatable logging item', $this->data->getMessage(), 'By default message gets logged.');
    $this->assertEquals('formattable logging item', $this->data->getMessage(), 'By default message gets logged.');
    $this->assertEmpty($this->data->getTrunc(), 'Message not truncated');
  }