Loading core/lib/Drupal/Core/Command/DrupalConsoleLogger.php +2 −1 Changes for core/lib/Drupal/Core/Command/DrupalConsoleLogger.php: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\Logger\LogMessageParserInterface; use Drupal\Core\Logger\RfcLogLevel; use Psr\Log\AbstractLogger; use Psr\Log\InvalidArgumentException; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use Psr\Log\LogLevel; Loading Loading @@ -54,7 +55,7 @@ public static function toPsr3(int $level): string { RfcLogLevel::NOTICE => LogLevel::NOTICE, RfcLogLevel::INFO => LogLevel::INFO, RfcLogLevel::DEBUG => LogLevel::DEBUG, default => throw new \InvalidArgumentException("Invalid log level: $level"), default => throw new InvalidArgumentException("Invalid log level: $level"), }; } Loading core/tests/Drupal/Tests/Core/Command/DrupalConsoleLoggerTest.php 0 → 100644 +29 −0 Changes for core/tests/Drupal/Tests/Core/Command/DrupalConsoleLoggerTest.php: 29 added lines, 0 removed lines. Original line number Diff line number Diff line <?php declare(strict_types=1); namespace Drupal\Tests\Core\Command; use Drupal\Core\Command\DrupalConsoleLogger; use Drupal\Tests\UnitTestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use Psr\Log\InvalidArgumentException; /** * Tests DrupalConsoleLogger. */ #[Group('command')] #[CoversClass(DrupalConsoleLogger::class)] class DrupalConsoleLoggerTest extends UnitTestCase { /** * Tests the exception thrown by ::toPsr3() due to an invalid argument. */ public function testToPsr3Exception(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessageIs('Invalid log level: -1000'); DrupalConsoleLogger::toPsr3(-1000); } } Loading
core/lib/Drupal/Core/Command/DrupalConsoleLogger.php +2 −1 Changes for core/lib/Drupal/Core/Command/DrupalConsoleLogger.php: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\Logger\LogMessageParserInterface; use Drupal\Core\Logger\RfcLogLevel; use Psr\Log\AbstractLogger; use Psr\Log\InvalidArgumentException; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; use Psr\Log\LogLevel; Loading Loading @@ -54,7 +55,7 @@ public static function toPsr3(int $level): string { RfcLogLevel::NOTICE => LogLevel::NOTICE, RfcLogLevel::INFO => LogLevel::INFO, RfcLogLevel::DEBUG => LogLevel::DEBUG, default => throw new \InvalidArgumentException("Invalid log level: $level"), default => throw new InvalidArgumentException("Invalid log level: $level"), }; } Loading
core/tests/Drupal/Tests/Core/Command/DrupalConsoleLoggerTest.php 0 → 100644 +29 −0 Changes for core/tests/Drupal/Tests/Core/Command/DrupalConsoleLoggerTest.php: 29 added lines, 0 removed lines. Original line number Diff line number Diff line <?php declare(strict_types=1); namespace Drupal\Tests\Core\Command; use Drupal\Core\Command\DrupalConsoleLogger; use Drupal\Tests\UnitTestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use Psr\Log\InvalidArgumentException; /** * Tests DrupalConsoleLogger. */ #[Group('command')] #[CoversClass(DrupalConsoleLogger::class)] class DrupalConsoleLoggerTest extends UnitTestCase { /** * Tests the exception thrown by ::toPsr3() due to an invalid argument. */ public function testToPsr3Exception(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessageIs('Invalid log level: -1000'); DrupalConsoleLogger::toPsr3(-1000); } }