Files
global-autoresponder/tests/plugin_logger_test.php
T
2026-06-02 22:57:23 +02:00

17 lines
591 B
PHP

<?php
declare(strict_types=1);
require_once PLUGIN_ROOT . '/exec/lib/PluginLogger.php';
test('plugin logger writes exceptions to plugin log file', function (): void {
$path = TEST_TMP . '/plugin.log';
PluginLogger::init($path);
PluginLogger::exception(new RuntimeException('DirectAdmin API command failed'), 'CREATE');
$log = file_get_contents($path) ?: '';
assert_contains('CREATE RuntimeException: DirectAdmin API command failed', $log);
assert_contains('plugin_logger_test.php', $log);
assert_same('0600', substr(sprintf('%o', fileperms($path)), -4));
});