
| Current Path : /var/www/html/stolberg/web/core/tests/Drupal/KernelTests/Core/Bootstrap/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/stolberg/web/core/tests/Drupal/KernelTests/Core/Bootstrap/LegacyBootstrapTest.php |
<?php
declare(strict_types=1);
namespace Drupal\KernelTests\Core\Bootstrap;
use ColinODell\PsrTestLogger\TestLogger;
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\Core\Utility\Error;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests legacy bootstrap functions.
*
* @group Bootstrap
* @group legacy
*/
class LegacyBootstrapTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['system'];
/**
* Tests watchdog_exception() deprecation.
*/
public function testWatchdogException(): void {
$logger = new TestLogger();
/** @var \Drupal\Core\Logger\LoggerChannelFactoryInterface $loggerFactory */
$loggerFactory = \Drupal::service('logger.factory');
$loggerFactory->addLogger($logger);
$this->expectDeprecation('watchdog_exception() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Utility\Error::logException() instead. See https://www.drupal.org/node/2932520');
$e = new \RuntimeException("foo");
watchdog_exception('test', $e);
$this->assertTrue($logger->hasRecordThatContains(Error::DEFAULT_ERROR_MESSAGE, RfcLogLevel::ERROR));
}
}