From 0572cc6aee34563398a2961fa8dd1e1056240b20 Mon Sep 17 00:00:00 2001 From: Tony Messias Date: Mon, 14 Oct 2024 19:42:18 -0300 Subject: [PATCH] Assert the log call --- src/TrixAttachment.php | 7 +++---- tests/ContentTest.php | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/TrixAttachment.php b/src/TrixAttachment.php index 40aed76..eecdfb7 100644 --- a/src/TrixAttachment.php +++ b/src/TrixAttachment.php @@ -4,6 +4,7 @@ use DOMElement; use Illuminate\Support\Arr; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; class TrixAttachment @@ -56,9 +57,7 @@ private static function typeCast(string $key, $value) }; } - public function __construct(public DOMElement $node) - { - } + public function __construct(public DOMElement $node) {} public function attributes(): array { @@ -93,7 +92,7 @@ private function readJsonAttribute(string $key): array $data = json_decode($value ?: '[]', true); if (json_last_error() !== JSON_ERROR_NONE) { - logger(sprintf( + Log::notice(sprintf( '[%s] Couldnt parse JSON %s from NODE %s', static::class, $value, diff --git a/tests/ContentTest.php b/tests/ContentTest.php index e4182f5..1fd2825 100644 --- a/tests/ContentTest.php +++ b/tests/ContentTest.php @@ -2,6 +2,7 @@ namespace Tonysm\RichTextLaravel\Tests; +use Illuminate\Support\Facades\Log; use Tonysm\RichTextLaravel\Attachables\ContentAttachment; use Tonysm\RichTextLaravel\Attachables\MissingAttachable; use Tonysm\RichTextLaravel\Attachables\RemoteImage; @@ -209,6 +210,8 @@ public function converts_trix_formatetd_attachments_with_custom_tag_name() /** @test */ public function ignores_trix_formatteed_attachments_with_bad_json() { + Log::shouldReceive('notice')->once(); + $html = <<<'HTML'
HTML;