isFile()) { continue; } $relative = substr($file->getPathname(), strlen(PLUGIN_ROOT) + 1); if (str_starts_with($relative, '.git/') || str_starts_with($relative, 'tests/')) { continue; } $content = file_get_contents($file->getPathname()) ?: ''; if (preg_match('/TODO|TBD|FIXME|placeholder|not implemented/i', $content)) { $bad[] = $relative; } } assert_same([], $bad); }); test('package source contains no mx helper implementation or mode switch', function (): void { assert_false(is_dir(PLUGIN_ROOT . '/mx-helper'), 'mx-helper directory must not be shipped'); $forbidden = []; $needles = ['MX_LOGIN_MODE', 'mail-login-helper', 'mail-login-create-url', '/mx-helper/']; $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PLUGIN_ROOT, FilesystemIterator::SKIP_DOTS)); foreach ($it as $file) { if (!$file->isFile()) { continue; } $relative = substr($file->getPathname(), strlen(PLUGIN_ROOT) + 1); if (str_starts_with($relative, '.git/') || str_starts_with($relative, 'tests/')) { continue; } $content = file_get_contents($file->getPathname()) ?: ''; foreach ($needles as $needle) { if (str_contains($relative, $needle) || str_contains($content, $needle)) { $forbidden[] = $relative . ':' . $needle; } } } assert_same([], $forbidden); }); test('directadmin entry points use mx autologin directory and display label', function (): void { $txt = file_get_contents(PLUGIN_ROOT . '/hooks/user_txt.html') ?: ''; $img = file_get_contents(PLUGIN_ROOT . '/hooks/user_img.html') ?: ''; $login = file_get_contents(PLUGIN_ROOT . '/user/login.raw') ?: ''; $index = file_get_contents(PLUGIN_ROOT . '/user/index.html') ?: ''; assert_contains('/CMD_PLUGINS/mxautologin/login.raw', $txt); assert_contains('Zaloguj do serwera poczty', $txt); assert_contains('/CMD_PLUGINS/mxautologin/images/user_icon.svg', $img); assert_contains('alt="Zaloguj do serwera poczty"', $img); assert_contains('/usr/local/directadmin/plugins/mxautologin/php.ini', $login); assert_contains('/CMD_PLUGINS/mxautologin/login.raw', $index); }); test('plugin icon follows directadmin login screen palette', function (): void { $icon = file_get_contents(PLUGIN_ROOT . '/images/user_icon.svg') ?: ''; assert_contains('#2c8ec4', $icon); assert_contains('#00689c', $icon); assert_contains('#ff8a2a', $icon); assert_contains('#ffffff', $icon); assert_not_contains('#14532d', $icon); });