Files
global-autoresponder/tests/handler_test.php
T
2026-06-02 19:32:58 +02:00

31 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
test('mockup and planned UI do not expose backend terms', function (): void {
foreach (glob(dirname(__DIR__, 2) . '/docs/mockups/*.html') ?: [] as $file) {
$html = file_get_contents($file) ?: '';
assert_false(stripos($html, 'Exim') !== false, basename($file) . ' exposes Exim');
assert_false(stripos($html, 'DirectAdmin API') !== false, basename($file) . ' exposes API');
assert_false(stripos($html, 'backend.sh') !== false, basename($file) . ' exposes backend script');
}
});
test('mockup forms include calendar classes and delete confirmation view', function (): void {
$create = file_get_contents(dirname(__DIR__, 2) . '/docs/mockups/02-dodaj.html') ?: '';
$delete = file_get_contents(dirname(__DIR__, 2) . '/docs/mockups/04-podglad-usun.html') ?: '';
assert_contains('br-restore-calendar', $create);
assert_contains('br-calendar-grid', $create);
assert_contains('Potwierdź usunięcie', $delete);
assert_false(stripos($delete, 'checkbox') !== false);
});
test('directadmin user hooks are clickable and point to reserved icon path', function (): void {
$img = file_get_contents(PLUGIN_ROOT . '/hooks/user_img.html') ?: '';
$txt = file_get_contents(PLUGIN_ROOT . '/hooks/user_txt.html') ?: '';
assert_contains('<a href="/CMD_PLUGINS/global-autoresponder/index.html"', $img);
assert_contains('<img src="/CMD_PLUGINS/global-autoresponder/images/user_icon.svg"', $img);
assert_contains('<a href="/CMD_PLUGINS/global-autoresponder/index.html"', $txt);
assert_contains('Globalne autorespondery', $txt);
});