17 lines
591 B
PHP
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));
|
|
});
|